Here are 10 basketball players with their average points per game.
Adam, John, Charlie, Doug, Tommy, Frank, Gerry, Henry, Bill, Jimmy
5.8, 10.7, 15.3, 9.0, 13.4, 21.1, 9.2, 14.5, 11.3, 7.5
Write a Java program to identify and print out the player names with the highest and lowest average point per game. You must use arrays or array lists to solve this problem.
BaskkeBallTest.java
public class BaskkeBallTest {
public static void main(String[] args)
{
String players[] = {"Adam", "John",
"Charlie", "Doug", "Tommy", "Frank", "Gerry", "Henry", "Bill",
"Jimmy"};
double points[] = {5.8, 10.7, 15.3,
9.0, 13.4, 21.1, 9.2, 14.5, 11.3, 7.5};
double max = points[0], min =
points[0];
String highestPlayer =
players[0], lowestPlayer = players[0];
for(int i=0;i<points.length;i++)
{
if(max <
points[i]) {
max = points[i];
highestPlayer = players[i];
}
if(min >
points[i]) {
min = points[i];
lowestPlayer = players[i];
}
}
System.out.println("Higest Player:
"+highestPlayer);
System.out.println("Lowest Player:
"+lowestPlayer);
}
}
Output:
Higest Player: Frank
Lowest Player: Adam
Here are 10 basketball players with their average points per game. Adam, John, Charlie, Doug, Tommy,...
A basketball scout wants to compare the points per game of two NBA players. The average points per game including its standard deviation is shown below. On average, which player is the higher scorer? Which player is a more consistent scorer? Player A 27 6.6 Player B 31.6 8.4