Create a class to implement a doubly linked list to store student records. Besides the basic operations, the class should include a sorting method that allows the user to sort the records in the list by student id (ascending or descending). [Since there is no shifting needed, linked list is an idea data structure to do Insertion Sort.]
1.Create a doubly linked list in Java. Each element in the list contains a data which is an object of a Student class and two links, next and previous.
2.Student class - contains two class fields only:
1)id – It is a unique number (string type)
2)name - The first and last names are in one string
3)Create the toString() method in this class to allow the list class to display the content of an object. Organize the data properly for displaying.
3.RecordList class - the doubly linked list class defined as follow:
1)The list contains ‘first’ and ‘last’ references
(You may refer the classes for the doubly linked list in the textbook.)
2)The list may contain insertFirst(), deleteFirst(), and any useful operations such as insertAfter() or insertBefore(), etc.
3)The list class includes a method insertionSort() to sort the contents of the list by using the insertion sort methodology.
[Note: the data should not be ordered during the input (insert) stage. This assignment is for you to practice the implementation of the insertion sort algorithm by using a doubly linked list.]
4)The list class must have the toString () for application class to display the content of all nodes in the list. This method invokes toString() defined in the Student class.
4.Write an application class to allow a user to:
1)Insert a Student record in the list (insert at ‘first’ or ‘last’ in your implementation)
2)Sort the list
3)Display the list (from the ‘first’ element)
4)Quit from the system.
The system should continue to serve the user till the user select to quit. The system should prompt the user properly for any input and operation results including the error messages. [Hint: To insert a new record into the list, get the data (name and id) from user in app class, create an object of Student, and then invoke the regular insert method, e.g. insertFirst() or insertLast() to insert.]Attachments