Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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:

image text in transcribed image text in transcribed

HOLLYWOOD

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago