In this program, you will build a Netflix movie database using the provided file, netflix.csv. The file
Question:
In this program, you will build a Netflix movie database using the provided file, netflix.csv. The file contains more than two hundred records of movies and TV programs, with each record consisting a title, a rating, a release year, and a user rated score.
There are three classes that you will need to implement: Movie, NetflixHandler, and NetflixApp.
Class: Movie
Movie |
- title: String - rating: String - year: int - score: int |
+ Movie (String title, String rating, int year, int score) + getTitle(): String + getRating(): String + getYear(): int + getScore(): int + toString(): String |
Instance variables:
- title: Title of a movie or TV program.
- rating: Rating of a movie or TV program. E.x.: R or PG-13
- year: Year of release.
- score: User rated score.
Methods:
- Movie (String title, String rating, int year, int score): An overloaded constructor.
- Getters for all the instance variables.
- toString(): It returns a string of information: title year rating score
Class: NetflixHandler
NetflixHandler |
- data: Movie[] - actualSize: int + SIZE: int = 500 |
+ NetflixHandler () + read (String filePath): void + displayAllMovies (): void + searchTitle (): void + searchYear (): void + sort (Movie[] movies, int size): void + makeRecommendations(): void |
Instance variables and constants:
- data: It is an array of Movie objects.
- actualSize: It is the real number of Movie objects in a partially filled array.
- SIZE: A constant that is set to be 500.
Methods:
- NetflixHandler (): The default constructor that initializes the instance variable, data, to a Movie array that has a size of 500.
- read (): This method opens the given file, netflix.csv, and reads it. While reading the file line by line, it also creates a Movie object and saves it into data.
- displayAllMovies (): This method loops through all the Movie objects saved in data and display their information.
- searchTitle (): This method looks for a movie that matches the title provided by a user.
- searchYear (): This method looks for a group of movies that match the release year given by a user.
- sort (Movie[] movies, int size): This method sorts a given Movie array, movies, using the provided size. It sorts the array into a descending order based on the user rated score.
- makeRecommendations (): This method makes recommendations to a user based on two options. Option one: It finds the top-5 movies, based on the user rated score, under a certain rating. The method then writes those 5 movies into a file, “top_5_movies.txt”. Option two: It finds the top-20 movies, based on the score only. The method then writes those 20 movies in to a file, “top_20_movies.txt”.
Class: NetflixApp
This is the main class. It has a private and static method, menu, which displays a menu that contains several choices (Please see the expected outcomes file for more details.). The main method should create a NetflixHandler object and let it call the read method before taking any choices.
Principles of Information Systems
ISBN: 978-1133629665
11th edition
Authors: Ralph Stair, George Reynolds