Question: Chapter 5, PP 10 Java Project Name: IC15_Movie Implement a class named Movie that contains information about a movie. The Movie class has the following

Chapter 5, PP 10 Java Project Name: IC15_Movie

Chapter 5, PP 10 Java Project Name: IC15_Movie Implement a class named

Implement a class named Movie that contains information about a movie. The Movie class has the following instance variables (a.k.a. fields or data):

The movie name The director's name The MPAA rating (e.g. G, PG, PG-13, R) Number of people who have rated movie as terrible (1) Number of people who have rated movie as bad (2) Number of people who have rated movie as ok (3) Number of people who have rated movie as good (4) Number of people who have rated movie as excellent (5)

The Movie class will have methods to:

Create a new Movie (given a movie name, director name and MPAA rating) [constructor] Create a new Movie (from another Movie) [copy constructor]

*** Add accessors/mutators for: movie name, director name, MPAA rating*** *** Add only accessors for: getTerribleNumber - returns the number of people who rated movie as terrible getBadNumber getOkNumber getGoodNumber getExcellentNumber

calculateAverageRating - calculates and returns the average rating by multiplying the number of terrible ratings * 1, bad ratings * 2, ok ratings * 3, good ratings * 4, excellent ratings * 5 and dividing by the total number of ratings. If there are no ratings for the movie yet, return 0.0 addRating(int rating) - adds a rating for the movie, returns true if rating is between 1-5, false otherwise. removeRating(int rating) - removes a rating for a movie. Returns true if rating is between 1-5 and there is at least one rating to remove, false otherwise equals - method to check if one Movie is the same as another by comparing all instance variables toString - method to turn a Movie into a string for display, e.g. display as "Movie [Name=Orange County, Director=Jake Kasdan, MPAA Rating=PG-13, Average Rating=2.5]"

Below is a class diagram to assist with the requirements of the Movie class:

Movie that contains information about a movie. The Movie class has the following instance variables (a.k.a. fields or data): The movie name The director's

HOLLYWOOD

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!