Problem Statement
You are to refine the program that reads in Students from a data file. Each student should be stored in a Student object.
This program adds on to the requirements for Program #2. Please see that assignment. This will read in the same type of data from an input file and write the results to an output file.
New Requirements
1. You are to re-implement the StudentList data structure/data type that stores students using a doubly
linked-list. Store the students in the list in alphabetical order (By lastname, use firstname to further
distinguish in the event there is more than 1 student with the same last name). That is, each time you
add a new student to the list, you must insert it in the correct location.
2. You must implement the same operations on this new version of StudentList that were required for assignment #2. In addition, you will need to add at least two new operations to support the following requirement:
We are going to use our list as a sort of directory, or white pages of sorts. Prompt the user to look up a student by first and last name. If the matching student is found in the list, print out only that student's record. If the student is not found, you should print the two nearest students (the 1st one before and the 1st one after) to the desired student. Note - in order for this to work, your operations are going to have to have some concept of where the search stops in the list (in the middle, at the end, etc). You can implement the printer operation as a method on the list so it has this information at its disposal.
Some Examples - Suppose I have the following people in my list
Hank Aaron
Andruw Jones
Chipper Jones
John Smith
Josh Thomas
If I search for Hank Aaron, only Hank Aaron should be displayed as found in the list
If I search for Mark Jones, then Chipper Jones and John Smith should be displayed as two nearest to the desired information (before and after).
If I search for Jack Williams, then John Smith and Josh Thomas should be displayed.
3. You must provide the user with the ability to delete a student from the list by providing their
firstname and lastname. Only delete the student node with an exact match.
Comments