Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a class Movie that contains information about a movie. The class has the following attributes: The movie name The MPAA rating (G, PG, etc)

Consider a class Movie that contains information about a movie.

The class has the following attributes:

The movie name The MPAA rating (G, PG, etc)

The number of 1-star reviews

The number of 2-star reviews

The number of 3-star reviews

The number of 4-star reviews

The number of 5-star reviews

Implement this class and create the following methods:

An accessor and mutator (also called getters and setters, respectively) for the movie name.

An accessor and mutator (also called getters and setters, respectively) for the MPAA rating.

addReview(int stars) that takes in an integer as an input param- eter. The method should verify if the parameter is between 1 and 5, and if so, increment the number of reviews with that many stars by one.

Write another method, getAverage(), which returns then average value for all the reviews.

Test the class by writing a main method that creates at least two movie objects, adds at least five ratings for each movie, and outputs the movie name, the MPAA rating, and the average rating fo each movie object.

please solve this project using JAVA(NetBeans IDE is recommanded). Also follow the instructions given above and use the methods. Make sure the code is working and with proper comments to indicate how the code working and its purpose.

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

More Books

Students also viewed these Databases questions