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

1 Expert Approved Answer
Step: 1 Unlock

Create a Student class with appropriate attributes such as name GPA and credit hours Implement the C... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!