last updated: Thu Apr 18
CS1007
Spring 2002
Homework #6
due THU May 2, by 6AM -- electronic submission
hardcopy due IN CLASS: 11.05AM cs1007-002; 2.45PM cs1007-001

goal.
This is your last homework assignment for cs1007 (yippee!). The goal is to put together many of the pieces we've learned this semester into one program. The description of this program (below) is a more general type of specification than you've had for your previous homeworks. You will have to make the design and implementation decisions yourself, though you can use examples from class to help you get started.
This assignment is worth a total of 10 points. There are 3 points of extra credit available in this assignment!!

Note: As above, there will be no extensions on this assignment. The only exception is if you have a documented medical excuse.

specifications.
You need to design and implement software for a movie database. The program interfaces with a data file (i.e., a text file, like we discuss in class on Tue Apr 23). The data file contains data records. Each record contains the following:

Your program will be text only (not a GUI), run with a command line interface to a text menu that will allow users the following options: The program will start by reading the current database from the data file (named hw6.dat), as described below. Note that any modifications your user makes to the database must be written back to the data file (i.e., adding and removing records).

The program will then continue running by displaying the menu of choices (above), prompting the user to enter a choice, reading the user's choice and processing the user's choice -- until the user decides to quit, at which the program will update the database file and exit.

You MUST use bubble sort to sort the entries in the movie database using the name of the movie as the key.

You MUST use recursive binary search to find a movie in the database, using the name of the movie as the key.

design.
You MUST write a SHORT design document describing your approach to the program. This description MUST include the following:

Note: This design document will ONLY be submitted in hard copy. Do NOT submit this part electronically.

implementation.
Your program MUST be a Java application. You can use as many class files as you need to, but the main() method MUST be contained in a file called hw6<yourCUNIXusername>.java, e.g., hw6eis2003.java. Don't forget to comment your code. Hint: your source code comments must be consistent with your design document!

You MUST use a standard format for the data file,, as follows:

sample run.

unix$ java hw6eis2003
There are 5 movies in the database
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> d
>>Attack of the Killer Tomatoes<<
>>Desk Set<<
>>French Kiss<<
>>French Lieutenant's Woman<<
>>Sleepless in Seattle<<
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> f
enter name of movie: Desk Set
>>Desk Set<<  starring: Katherine Hepburn and Spencer Tracey (G)
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> a
enter name of movie: Gone with the Wind
enter rating (0=G,1=PG,2=PG13,3=R,4=X): 1
enter star (0 when done): Vivian Leigh
enter star (0 when done): Clark Gable
enter star (0 when done): 0
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> d
>>Attack of the Killer Tomatoes<<
>>Desk Set<<
>>French Kiss<<
>>French Lieutenant's Woman<<
>>Gone with the Wind<<
>>Sleepless in Seattle<<
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> r
enter name of movie to remove: French Lieutenant's Woman
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> d
>>Attack of the Killer Tomatoes<<
>>Desk Set<<
>>French Kiss<<
>>Gone with the Wind<<
>>Sleepless in Seattle<<
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> s
enter name of star: Meg Ryan
Meg Ryan is in: 
French Kiss
Sleepless in Seattle
2 movies
D (isplay the names of the movies in the database)
A (dd a new movie to the database)
R (emove a movie from the database)
F (ind a movie)
S (tar search)
Q (uit)
enter choice> q
unix$

source code.
Your source code (i.e., your .java file) but be neat and clearly commented. You must have a header comment and you should comment the end of each block (i.e., each }). You need to COMMENT EVERY METHOD that you write within each class.

submission.
As usual, submit your program in two ways: electronically and hard copy.

points.
The assignment is worth 10 points, as follows:

If you do ALL of the above, you will earn 3 points of extra credit!!