Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS FOR C++. Consider a class Movie that contains information about a movie. The class has the following attributes: The movie name The MPAA

THIS IS FOR C++.

Consider a class Movie that contains information about a movie. The class has the following attributes:
The movie name
The MPAA rating (e.g. G, PG, PG-13, R)
The number of people that have rated this movie as a 1 (Terrible)
The number of people that have rated this movie as a 2 (Bad)
The number of people that have rated this movie as a 3 (OK)
The number of people that have rated this movie as a 4 (Good)
The number of people that have rated this movie as a 5 (Great)
Implement the class with accessors and mutators for the movie name and MPAA rating.
Write a method addRating that takes an integer as an input parameter.
The method should verify that the parameter is a number between 1 and 5, and if so,
increment by one the number of people rating the movie that matches the input parameter.
For example, if 3 is the input parameter, then the number of people that rated the movie as a 3 should be incremented by one.
Write another method, getAverage, that returns the average value for all the movie ratings.
Test the class by writing a main method that creates at least two movie objects, adds at least five ratings for each movie,
and output the movie name, MPAA rating, and average rating for each movie object.

Teacher's Guidelines:

This class should implement the following:

seven private member variables that will be used to describe the object attributes described in the programming problem.

a default constructor.

a constructor that accept an initial movie name and movie rating.

public accessor and mutator member functions getName(), setName(), setRating(), getRating(), addRating(), and getAverage().

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

What is the Big Bang Theory?

Answered: 1 week ago