Question: In Java, the report.txt must list the students sorted by either the gpa or number of credit hours. Use the Java Comparator interface to sort
In Java, the report.txt must list the students sorted by either the gpa or number of credit hours. Use the Java Comparator interface to sort the students. For that, copy the Student objects into an ArrayList that you sort by gpa or by credit hours - use the code provided:
for (int i = 0; i < count; i++){
if (persons[i] instanceof Student)
persons[i].report(myWriter);
}
myWriter.close();
Step by Step Solution
There are 3 Steps involved in it
Create a Student class with appropriate attributes such as name GPA and credit hours Implement the C... View full answer
Get step-by-step solutions from verified subject matter experts
