Using JAVA
not allowed to use algorithm constraints/<array lists>
Netflix Database
In this program, you will build a Netflix movie database usingthe provided file, netflix.csv. The file contains more than twohundred records of movies and TV programs, with each recordconsisting a title, a rating, a release year, and a user ratedscore.
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): Anoverloaded constructor.
- Getters for all the instance variables.
- toString(): It returns a string of information: title yearrating 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 apartially filled array.
- SIZE: A constant that is set to be 500.
Methods:
- NetflixHandler (): The default constructor that initializes theinstance variable, data, to a Movie array that has a size of500.
- read (): This method opens the given file, netflix.csv, andreads it. While reading the file line by line, it also creates aMovie object and saves it into data.
- displayAllMovies (): This method loops through all the Movieobjects saved in data and display their information.
- searchTitle (): This method looks for a movie that matches thetitle provided by a user.
- searchYear (): This method looks for a group of movies thatmatch the release year given by a user.
- sort (Movie[] movies, int size): This method sorts a givenMovie array, movies, using the provided size. It sorts the arrayinto a descending order based on the user rated score.
- makeRecommendations (): This method makes recommendations to auser based on two options. Option one: It finds thetop-5 movies, based on the user rated score, undera certain rating. The method then writes those 5 movies into afile, “top_5_movies.txt”. Option two: It finds thetop-20 movies, based on the score only. The methodthen writes those 20 movies in to a file, “top_20_movies.txt”.
Class: NetflixApp
This is the main class. It has a private andstatic method, menu, which displays a menu that containsseveral choices (Please see the expected outcomes file for moredetails.). The main method should create a NetflixHandler objectand let it call the read method before taking any choices.
EXPECTED OUTCOMES
Welcome to the Netflix Database
==========================================
1. Browse all movies.
2. Search a movie based ontitle.
3. Search movies based onyear.
4. Top moviesrecommendation.
5. Exit.
==========================================
Please make your choice: 8
Please provide a valid input: 9
Please provide a valid input: 1
Title Year Rating Score
WhiteChicks 2004 PG-13 82
Grey’sAnatomy 2016 TV-14 98
Prison Break 2008 TV-14 98
How I Met YourMother 2014 TV-PG 94
Supernatural 2016 TV-14 95
BreakingBad 2013 TV-MA 97
SAMPLE DATA
title | rating | release year | user rating score |
White Chicks | PG-13 | 2004 | 82 |
Grey’s Anatomy | TV-14 | 2016 | 98 |
Prison Break | TV-14 | 2008 | 98 |
How I Met Your Mother | TV-PG | 2014 | 94 |
Supernatural | TV-14 | 2016 | 95 |
Breaking Bad | TV-MA | 2013 | 97 |
The Vampire Diaries | TV-14 | 2017 | 91 |
The Walking Dead | TV-MA | 2015 | 98 |
Pretty Little Liars | TV-14 | 2016 | 96 |
Once Upon a Time | TV-PG | 2016 | 98 |
Sherlock | TV-14 | 2016 | 95 |
Death Note | TV-14 | 2006 | 77 |
Naruto | TV-PG | 2008 | 88 |
Arrow | TV-14 | 2015 | 96 |
Black Mirror | TV-MA | 2016 | 80 |
The Originals | TV-14 | 2016 | 74 |
Masha and the Bear | TV-Y | 2013 | 81 |
Expert Answer
Answer to Using JAVA not allowed to use algorithm constraints/ Netflix Database In this program, you will build a Netflix movie da…