Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The coach of the High Score College basketball team would like you to create a J

ID: 3600538 • Letter: T

Question

The coach of the High Score College basketball team would like you to create a Java class to analyze the basketball scores for the team. The coach would like to input the number of points scored by the team in each of the games they have played so far this year. Entering an * would signal the end of the scores. After entering all scores, he would like the following stats displayed:

Number of games played:
Total number of points scored:
Average score per game:
Highest number of points scored in one game: Lowest number of points scored in one game:

Explanation / Answer

import java.util.Scanner;


public class BasketBallScore {
public static void mian(String[] args) {
Scanner sc = new Scanner(System.in);
int high = 0;
int low = 10000;
int total = 0;
int gameCount = 0;
while(true) {
System.out.print("Enter a score (* to exit): ");
String entry = sc.nextLine();
if (entry.equals("*")) {
break;
}
gameCount++;
int score = Integer.parseInt(entry);
total += score;
if (score < low) {
low = score;
}
if (score > high) {
high = score;
}
}
sc.close();
  
if (gameCount != 0) {
System.out.println("Number of games played: " + gameCount);
System.out.println("Total number of points scored: " + total);
System.out.println("Average score per game: " +((float)total)/gameCount);
System.out.println("Highest number of points scored in one game: " + high);
System.out.println("Lowest number of points scored in one game:: " + low);
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote