Project on Linked Lists: CD Library
Project - The Stamford CD Library Database Dates :
Overview Note: you will undoubtedly need to have gone over Linked List background info in detail before doing this project. Having reviewed and understood some existing Linked List example code will go a long way toward helping you see how to approach this project. If you do not understand linked lists prior to starting, you will not be able to do this project.
This project will have you write a program to be used by the Stamford Library to keep an online list of all the CD's in it's catalog. The program will present a menu to the user (the librarian) to enable him or her to add a CD title, delete a CD title, find a CD title, and list all the CD titles available. The record for a CD must contain:
You should write a class called CDRecord that holds the five data items defined above, and a next reference so that it can be used in your linked list. This should be a well-designed class that protects it's data, has good defaults, etc.
You should write a CDList class that models a linked list of CDRecord objects.
You will write a CDLibrary class that contains the main method that should "drive" the program. It will have an "event loop" that will call methods as required on a CDLibrary object to ask the user for input, to process user input, etc. You will have one main function, and a number of other functions that should be used to perform various actions. The main program itself should be fairly short, and will probably have a while loop, with a switch statement inside to process the user's choices by calling functions. Do not make any method in CDLibrary other than the main method static unless you have a good design reason, and explain that reason in your method comments. (Generally try to avoid static methods as they are closely associated with procedural programming).
The decision flow starts in main, and flows to the right, depending on what the user chooses. After one of the logic paths is complete, control returns back to main, so the user can make another choice.
When you start the program, print out a nice welcome message, and then present the main menu to the user. You should present the menu to the user after each command completes. The user should never have to guess, or remember all the commands because they have scrolled off the screen.
You are not allowed to use any of the Java library data structure classes to implement the actual linked list, even if you've studied ahead and know how. You must implement your own linked list from scratch.
a) Each operation on the linked list (ADD, DELETE, LIST, etc) must be defined within a separate method. You will probably need other "helper" functions as well.
b) Your main program should be as small and as descriptive as possible. Functions should be reasonably small. Follow the guidance that "A function should do one thing, and do it well".
c) You should trap basic NumberFormatExceptions, as well as other basic input exceptions so that the user cannot crash your program with a simple typo.
d) You need to capture and deal with other types of bad input as well that don't cause exceptions. If the user enters a command that you don't understand (e.g., ZDD instead of ADD), you should notify them, and continue. Do NOT quit the program on these types of errors. You should print an informative error message (for the user) and continue.
e) Comment your code!
f) You MUST follow the order of input in the example above. If I enter "ADD" in your program, I expect to then enter a CD title, an artist name, etc, in that order. You should also duplicate the output as shown above as closely as possible.