We'll begin by using the Person class included here.
You should create three subclasses of Person: Undergrad, GradStudent, and Professor (you may already have these laying around). Undergrads and GradStudents have two additional instance variables: GPA and Major. They should also implement printSelf(). PrintSelf should print out the person's ID, name, and Date of Birth. For students, it should print out their major. For Professors, it should print out their department.
Templates for each of the subclasses are here:
Professors should have one additional instance variable: Department. They should also implement printSelf().
All of these derived classes should also implement the Comparable interface, which means they'll need to implement compareTo().
The original data file is in the following format:
Undergrad: Frederick Dilallo : 89136171 : 4/7/1983 : 2.63 : Communication Studies Grad Student: Amy Bunche : 85469658 : 8/2/1979 : 3.46 : History Professor: Allen Claeys : 91419913 : 5/5/1955 : African Studies
Notice that colons are used to separate the fields.
Following is a web-based form that will generate random lists of people for testing:
How many people do you want generated?
You should read in people one entry at a time and insert them into a linked list in sorted order using the Insertion Sort algorithm. Once all entries are in the list, you should then traverse the list in order and print out each person.
You should use the following rules to sort people:
Your linked list should consist of two classes - I've provided the skeletons here (for ListItem) and here (for LinkedList).
Finally, you should have a ListTester class that reads in each line of the file, creates the appropriate subclass of Person, and inserts them into the list in order. A skeleton can be found here.