Answer:
import java.util.Scanner;
public class Program
{
public static void main(String [] Args)
{
int A_grades = 0;
int B_grades = 0;
int C_grades = 0;
int D_grades = 0;
int F_grades = 0;
int count=0;
int max = 0;
int min = 9999999;
int num;
int total = 0;
int smallest = 0;
int largest = 0;
Scanner in = new Scanner(System.in);
System.out.println("Enter exam score as integer percentage in range 0 to 100");
System.out.println("And enter a negative score at the end of the list :");
int score = in.nextInt();
while(score>0)
{
count++;
if(score < 0){ // negative number
break;} // exit the infine loop
else if(score > max){ // find bigger one
max = score;}
else if(score < min) { // find smallest one
min = score;}
total = total + score; // the total for average
if(score <= 50 && score>0)
smallest = score;
if(score > 90 && score <=100)
largest = score;
if(score>=90 && score<=100)
A_grades++;
else if(score>=80 && score<=89)
B_grades++;
else if(score>=70 && score<=79)
C_grades++;
else if(score>=60 && score<=69)
D_grades++;
else if(score>=0 && score<=59)
F_grades++;
score = in.nextInt();
} //end while
System.out.println("Total number of scores is : " + count );
System.out.println("Total Number of each Letter grade : " + count);
System.out.println("Percentage of total for each letter grade : ");
System.out.println("Total number of A grades :"+ A_grades);
System.out.println("Total number of B grades :"+ B_grades);
System.out.println("Total number of C grades :"+ C_grades);
System.out.println("Total number of D grades :"+ D_grades);
System.out.println("Total number of F grades :"+ F_grades);
System.out.println("Lowest Score is :"+smallest);
System.out.println("Highest Score is :"+largest);
System.out.println("Average score : "+ (total / count));
}
}
Explanation:
The Java program is such that functions in this manner, It reads a list of exam scores given as integer percentages in the range 0 to 100. Displays the total number of grades and the number of grades in each letter-grade category as follows: 90 to 100 is a A, 80 to 89 is a B, 70 to 79 is a C, 60 to 69 is a D, and 0 to 59 is an F.
See attachment for program output.