Make a Movie Database program The purpose of this project is to give you a larger scale project that incorporates many o

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Make a Movie Database program The purpose of this project is to give you a larger scale project that incorporates many o

Post by answerhappygod »

Make a Movie Database program
The purpose of this project is to give you a larger scale
project that incorporates many of the concepts and ideas you have
learned in this course. It is also to give you a chance to make
something that would have real-world application. This course
attempted to blend theoretical and academic computer science
concepts with practical software development while teaching you how
to implement object-oriented programming techniques. Think of this
project as a sort of “capstone” of your Java studies this semester.
This project is a bit more “free form” than the others so you are
free to choose how to make it with a few constraints mentioned
below. Complete all of the specifications below for full credit.
Partial credit will be awarded for partially finished projects
based on my determination of how much of the workload to completion
you finished. You do need a bare minimum of an interactive
interface (keyboard entry portion) to receive any credit. Without
interaction, this program is not worthwhile. Good luck!
Steps:
Final Project Specifications
Background
You are tasked by your Project lead to create a console-based
Movie Database Management System. This application must be able to
handle creating new entries in a proprietary database as well as
returning searches for items in the current database.
! Use the filename “db.txt” as your database file to save to and
load in upon program start!
You MUST implement the following for full
credit:
(e.g. “Enter command >” )
a.) new entry
b.) search by actor
c.) search by year
d.) search by runtime (in minutes)
e.) search by director
f.) search by title
g.) quit
For “new entry” → Prompts to do the following:
Enter title >
Enter year >
Enter runtime (minutes) >
Enter actor 1 >
Enter actor 2 >
Enter Director >
You
must add this entry into the database in one-line (use delimiters
between tokens; come up with your own strategy for token order but
BE CONSISTENT!)
For “search by actor” → Prompts to:
Enter actor >
Once
actor is entered, search database (hopefully already in memory.)
Display a list of movie titles that the actor has been in. This
must display the titles of movies actor has been in regardless of
if actor was actor 1 or actor 2. (If nothing found, display “No
titles found for actor” and return to main prompt.)
For “search by year” → Prompt to:
Enter year >
Once
year is entered, search database and return list of titles made in
that year. (If nothing found, display “No titles found for year”
and return to main prompt.)
For “search by runtime” → Prompts to:
Enter runtime (minutes) >
Search
like how you did for year. Display list and return to main prompt.
If nothing found, display a prompt saying so and return to main
prompt.
For “search by director” → Prompts to:
Enter director >
Do
the same thing as you did with the actor search. Return list of
titles the director has done and return to main prompt. If none
found, post message and return to main prompt.
For “search by title” → Prompts to:
Enter title >
If
the title is found, return the following about title:
Actors: actor1, actor 2
Director: director name
Year: year made
Runtime: x minutes
if
title not found, post message saying so and return to main
prompt.
For “quit” → This simply exits the program (close out any open I /
O streams prior to exit!)
Other Requirements:
You
must make this object-oriented. You need to have a MINIMUM of four
(4) different classes interacting with the main method. The minimum
classes are:
You MUST save every entry added to the database to file.
This entry must be able to be restored later.
You MUST check that a new entry is valid before adding it to
memory (and the database.) To be valid, the entry must have at
least a title (minimum length of valid title is three characters.)
All other fields can be empty as needed.
The program MUST not have errors, warnings, or runtime
errors (bugs) to receive full credit.
You MUST create at least fifty
(50) valid entries for your database and submit this file as part
of your .zip file deliverable. (You can research movie data at the
Internet Movie Database at imdb.com)
Extra Credit Opportunity!
Receive 20 points of extra credit if you also add an option to
“delete entry.” This must follow the following to get the
credit:
Have “delete entry” as a command that can be entered from the main
prompt
For “delete entry” → Prompts to:
Enter title to delete >
Once
title is entered, if it exists, delete it from memory (and the
database file). If it isn't found, display “Title not found” and
return to the main prompt.
templates to use:
Database
package Main;

import java.util.ArrayList;

public class Database {
// Fields
private ArrayList<Movie> movies;

// Constructor
public Database(String filename){
movies = new ArrayList<>();
fileRead fr = new fileRead(filename);
for(int i = 0; i < fr.getNumberOfLines(); i++){
String raw = fr.getLine(i);
// TODO: Parse using the StringTokenizer here and place into movies
as single entries...
}
}

// Methods
public void addEntry(Movie newEntry){
// TODO
}

public void searchByTitle(String title){
// TODO
}

public void searchByActor(String actor){
// TODO
}

public void searchByDirector(String director){
// TODO
}

public void searchByYear(int year){
// TODO
}

public void searchByRuntime(int runtime){
// TODO
}
}
fileRead
package Main;

import java.util.ArrayList;

public class fileRead {
// Fields
private ArrayList<String> lines;

// Constructor
public fileRead(String filename){
lines = new ArrayList<>();
//TODO: Open the filename, read in the data into the lines
arraylist, and close the file when done...
}

// Methods
public int getNumberOfLines(){
// TODO
}

public String getLine(int index){
// TODO
}
}
fileWrite
/* READ THIS!: The idea behind this class is that we save the
"writeBuffer" in memory but do not actually write the file to disk
until someone calls the
* "saveFile" method. The reason for this is for performance
and to prevent keeping an open file pointer (which is poor form and
risky) */

package Main;

import java.util.ArrayList;

public class fileWrite {
// Fields
private ArrayList<String> writeBuffer;
private String filename;

// Constructor
public fileWrite(String filename){
this.filename = filename; // Save filename for later
writeBuffer = new ArrayList<>();
}

//Methods
public void writeLine(String newLine){
// TODO: Add the newLine to the writeBuffer...

}

public void saveFile(){
// TODO: Save all of the lines in the writeBuffer to the file
(given in filename)

}
keyboardInput
package Main;

import java.util.Scanner;

public class keyboardInput {
// Fields
private Scanner keyb;

// Constructor
public keyboardInput(){
keyb = new Scanner(System.in);
}

// Methods
public String getKeyboardLine(){
// TODO: Use the scanner object to acquire a String and return this
String to the caller

}

/* Call this method before you exit the program! Do NOT close the
scanner object inside of getKeyboardLine method! */
public void closeKeyboard(){
keyb.close();
}
}
Movie
package Main;

public class Movie {
// Fields
private String title;
private String actor1;
private String actor2;
private String director;
private int year;
private int runtimeMinutes;

// Constructor
public Movie(String title, String actor1, String actor2, String
director, int year, int runtimeMinutes){
// TODO
}

// Methods
public String getTitle(){
// TODO
}

public String getActor1(){
// TODO
}

public String getActor2(){
// TODO
}

public String getDirector(){
// TODO
}

public int getYear(){
// TODO
}

public int getRuntime(){
// TODO
}

// Optional
public boolean isActorInMovie(String actor){
// TODO
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply