Answer:
import java.util.*;
public class HighestGrade
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = 5;
ArrayList<Integer> grades = new ArrayList<Integer>(n);
for (int i = 1; i <= n; i++)
{
System.out.print("Enter a grade (between 0 and 100): ");
int num = sc.nextInt();
grades.add(num);
}
int max = grades.get(0);
for (int i = 1; i < n; i++) {
if (grades.get(i) > max) {
max = grades.get(i);
}
}
System.out.print("The highest grade is: "+max);
}
}
Explanation:
The class HighestGrade application rompts the user for five grades between 0 and 100 points and stores the grades in an ArrayList. HighestGrade then traverses the grades to determine the highest grade and then displays the grade along with an appropriate message.