Project 3
Due Wednesday, April 12 11:55pm.
Submission through SVN.
Please submit your work in SVN directory
https://www.cs.usfca.edu/svn/< your username >/cs112/proj3
e.g. https://www.cs.usfca.edu/svn/ejung/cs112/proj3
Learning outcome
You will learn to read JavaDoc and implement matching the specifications in JavaDoc. You will also get more familiar with class and method interactions. Your project 1 and 2 already have most of the code for MovieDatabase's constructor, MovieDatabase's searchByTitle method, and Driver. You will reuse the previously submitted code in more object-oriented design.
Specifications
- JavaDoc contains detailed specification. Your submission should match all the details in the JavaDoc.
- Movie class has 3 instance variables: title (String type), year (int type), and director (String type).
- All instance variables in Movie class are protected final.
- All instance variables in Movie class are initialized in a constructor.
- Movie class has toString method that returns String that contains all 3 instance variables' content.
- MovieDatabase class has 1 instance variable: movies (ArrayList type).
- All instance variables in MovieDatabase class are private.
- All instance variables in MovieDatabase class are initialized in a constructor. The constructor takes a file name,reads movie information to create Movie objects, and adds the Movie objects to ArrayList movies.
- MovieDatabase class has searchByTitle method.
- Driver class reads the file name from the program argument if provided, and from the user's keyboard input if not. Driver class passes this file name to MovieDatabase constructor. Here is a sample file
- Driver class asks user for search keywords, passes them to MovieDatabase's searchByTitle method, and prints the returned result.
Example Runs
Example Run 1 (file name is provided in the program argument)
--------------
Welcome to USFlix!
Enter keywords: monster
Monsters University (2013)
Director: Dan Scanlon
Example Run 2 (file name is not provided in the program argument)
--------------
Please enter the movie database file name: movies.txt
Welcome to USFlix!
Enter keywords: university
Monsters University (2013)
Director: Dan Scanlon
Example Run 3
--------------
Welcome to USFlix!
Enter keywords: ball
No results found
Extra credit
If you wish to receive extra credit for early submission, then note which one you have tried in README.
- (Up to 10%) Implement searchByDirector method in MovieDatabase class. Demonstrate that this method works by using it in Driver. Similar to searchByTitle, Driver class asks user for search keywords, passes them to MovieDatabase's searchByDirector method, and prints the returned result.
public ArrayList searchByDirector(String name)
Submission
Submit Movie.java, MovieDatabase.java, Driver.java, and README. In the README, explain how your program works. In particular, explain how you integrated and changed the code from project 2.