Write a JAVA program that prompts the user for student grades and displays the highest and lowest grades in the class. The user should enter a character to stop providing values.
Starter code:
import java.util.Scanner;
public class MaxMinGrades{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Enter as many student grades as you like. Enter a character to stop.");
double grade = input.nextDouble();
double minGrade = Double.MAX_VALUE;
double maxGrade = Double.MIN_VALUE;
while (Character.isDigit(grade)) {
if (grade == 0) {
break;
}
if (grade < minGrade) {
minGrade = grade;
}
if (grade > maxGrade) {
maxGrade = grade;
}
}
System.out.println("The highest grade is: " + maxGrade);
System.out.println("The lowest grade is: " + minGrade);
}
}