Question: Using the input file called StudentInputFile.txt, input these students into a linked list sorted according to their age. In each case I made the student's
Using the input file called StudentInputFile.txt, input these students into a linked list sorted according to their age. In each case I made the student's last name their age as a string so when the input file says "John" "Twenty" 20 this means the student's first name is John, last name is Twenty, and age is 20. This is so that when you output the list you can easily tell if it is sorted by looking at the last names.
I have given you a class called Student. You will have to add a compareTo method so this class can implement comparable. Do NOT add a getAge() method to the class. In main I want you to be able to compare two Student objects.
Do not use an array or any other data structure other than the list. Do not add them to the list and then sort the list. I want you to add each node to the list in the "correct" place in order to keep the list sorted as you are building it. Then output the contents of the list.
StudentInputFile.txt:
Marty Twenty 20
Elizabeth Fifty 50
Christy Nineteen 19
Graham TwentyFive 25
Doris FiftyOne 51
Eleanor ThirtyFive 35
Mark Nineteen 19
Margaret Forty 40
Jessica ThirtyOne 31
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
