Assignment 7 – Literature Database (version 2)
Maximum Points = 50
The purpose of this lab is to continue your study of computer programming and algorithms using the Java programming language. In this lab you will use several new Java features including – ArrayLists and loops to extend Assignment 5 [YOU MUST CREDIT YOUR SOURCES FOR ANY CODE THAT IS NOT ENTIRELY YOUR OWN].
In this lab you will write a program that reads data from a file and stores the listing of the novels in an arraylist of novels.
v Your program must read the data from a file where the user is asked for the file name (default = novels.txt )
v The data in the file will consist of up to 10000 novels (each novel will consist of a title, author’s name, date published, and genre) where each component will be separated by the comma (,) symbol as shown below:
Time Machine, H. G. Wells, 1895, Science Fiction
Gulliver's Travels, Jonathan Swift, 1726, Satire
v Your program must include a class that will hold the Novel data (complete with constructor(s), get and set methods for each instance variable, and a toString method that returns the contents of the instance variables). [Give credit if you used any of my or another’s code.] Include an additional method getAge (returns the age of the novel from the date published and the current date using the Calendar class.) [see the solution for Assignment 5]
v Once your program has collected the data, you need to
a) display all of the novels,
b) print the number of novels,
c) print the oldest and the most recently published novels in the list and their age,
d) print the list of novels that match the user’s favourite genre.
v Your listing should have a title at the top in a larger font (and possible different font face and color) along with a graphic. The listing of the novels should display the data from the file.
v Modularize your program to minimize the amount of changes you would need to make if we change the number of novels.
EXTRA CHALLENGES:
· add images.
· Sort and print the list of novels in alphabetical order
· Ask the user to add novels to the list.
Make sure that your program uses proper indentation and complete documentation. See http://csc.columbusstate.edu/summers/NOTES/1301/style.htm for guidelines.
The program heading should occur at the top of the program and should include:
/**
* PROGRAM SPECIFICATIONS
* NARRATIVE DESCRIPTION:
*
* @author (your name)
* @version (date)
*/
Due before 8 a.m. on Wednesday, November 7, 2012) Submit a .doc file containing the UML class diagrams (including the “main” class) showing inheritance for all the classes used in your program and your timesheet documenting your time so far to the dropbox in WebCT. [10 pts]
(Due before 8 a.m. on Wednesday, November 14, 2012) Submit your .java files containing your program and your timesheet documenting your time to the dropbox in WebCT.
Submit your .java files containing your program and your timesheet documenting your time to the dropbox in WebCT.
Grades are determined using the following scale: