We appreciate your visit to Write a program to read a list of exam scores given as integer percentages in the range 0 100 Display the total number of grades. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

Write a program to read a list of exam scores given as integer percentages in the range 0-100. Display the total number of grades in each letter grade defined as follows:

- 90-100 is an A
- 80-89 is a B
- 70-79 is a C
- 60-69 is a D
- 0-59 is an F

Use a negative score as a sentinel to indicate the end of the input (the negative value is used just to end the loop, do not use it in the calculations). Then output the highest and lowest score, and the average score.

For example, if the input is: `72 98 87 50 70 86 85 78 73 72 72 66 63 85 -1`

The output would be:
```
Total number of grades = 14
Number of As = 1
Number of Bs = 4
Number of Cs = 6
Number of Ds = 2
Number of Fs = 1
The highest score is 98
The lowest score is 50
The average is 75.5
```

This is what I have so far, and it is not working correctly:

```java
public static void main(String[] args) {
// Scanner
Scanner scnr = new Scanner(System.in);

// Ints grades and count
int x;
int A = 0;
int B = 0;
int C = 0;
int D = 0;
int F = 0;
int count = 0;

// Int min, max, total
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
int total = 0;

// Double
double average;

// Prompt user for input
System.out.print("Please enter the exam scores as integer percentages in the range 0-100. ");
System.out.println("Please end the list with a negative integer.");

// Input scores and calculations
while ((x = scnr.nextInt()) >= 0) {
total += x;
count++;

if (x < min) min = x;
if (x > max) max = x;

// Grade classification
if (x >= 90) A++;
else if (x >= 80) B++;
else if (x >= 70) C++;
else if (x >= 60) D++;
else F++;
}

// Calculate average
average = (count > 0) ? (double) total / count : 0;

// Results/output
System.out.println("Total number of grades: " + count);
System.out.println("Number of A's: " + A);
System.out.println("Number of B's: " + B);
System.out.println("Number of C's: " + C);
System.out.println("Number of D's: " + D);
System.out.println("Number of F's: " + F);
System.out.println("Highest score: " + max);
System.out.println("Lowest score: " + min);
System.out.println("Average: " + average);
}
```