$29
Purpose
The purpose of this assignment is to introduce you to basic operations on a linked list.
Specifics
Design a program that generates a linked list of randomly generated Integer objects. Present a menu at program start that gives the user the following options (most of these options will have corresponding methods in a Linked List class):
Create a new list. The size will be specified by the user, make sure a non-negative value is entered. If there is a pre-existing list when this option is chosen, make sure you delete the contents of that list before creating your new list.
Sort the list. How you implement this is up to you. You can insert items in the list such that the list is always in sorted order or you can write a sort routine. You may not call a sort routine provided by the Java API.
Print the list (to the screen), one number per line.
Extra credit – 5 points: Print the list in reverse order (to the screen), one number per line. If you do not attempt the extra credit, make this menu choice display the message “Extra credit not attempted”.
Generate a sub-list that contains all the even numbers in the current list. This list should be returned and the contents should be displayed (to the screen), one number per line.
Print the contents of every "nth" node in the list. Obtain the "n" from the user, ensure it is greater than 0.
Delete node(s) containing an integer value entered by the user. You should report how many were deleted to the user.
Delete the contents of the current list.
Quit
You may use any linked list implementation you wish (singly linked, doubly linked, dummy head node, circular).
In addition to your LinkedList class, include a driver file called ListTester that will contain the menu and anything else you deem necessary (perhaps a utility to generate random Integers...).
Keep things modular and encapsulate your data properly -- do not let anything outside the Linked List class have direct access to any of the nodes.
Do not accept invalid input of any type from the user and do not let user input crash your program.
To Turn In:
This assignment must be submitted in working order by posted due date (see Canvas for due date.) Submit a zip file with:
your source files
minimal documentation (be sure and give at least a brief description of the program, document anything that doesn't work, extra credit attempted and document anything you feel is non-trivial - proper naming conventions, etc. must still be followed)