Highlights
Task:
General Description
In this assignment, you will create a Java program to read undergraduate and graduate students from an input file, sort them, and write them to an output file.
This assignment is a follow up of assignment 5. Like assignment 5, your program will read from an input file and write to an output file. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. Unlike assignment 5, the Student objects are sorted before they are written to the output file.
• The program must implement a main class, three student classes (Student, UndergradStudent, GradStudent),
and a Comparator class called StudentIDComparator.
• The StudentIDComparator class must implement the java.util.Comparator interface, and override the compare() method. Since the Comparator interface is a generic interface, you must specify Student as the type parameter when defining the StudentIDComparator class, i.e., public class StudentIDComparator implements Comparator<Student> {
• The signature of the compare method should be public int compare(Student s1, Student s2). The compare() method returns a negative, 0, or positive integer if s1 is less than, equals, or is greater than s2, respectively.
• To sort the ArrayList, you need to create a StudentIDComparator object and use it in the Collections’ sort method:
StudentIDComparator idSorter = new StudentIDComparator();
Collections.sort(students, idSorter); //students is an arrayList of Students
This IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment Experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.