Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (Movie Class) a). (70pts) Design a class Movie that contains information about a movie. The class has the following attributes (member variables) The movie
1. (Movie Class) a). (70pts) Design a class Movie that contains information about a movie. The class has the following attributes (member variables) The movie name The MPAA rating (for example, 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) The class should have the following member functions A constructor that allows the programmer to create the object with a specified name and MPAA rating. The number of people rating the movie should be set to 0 in this constructor A destructor which is automatically executed whenever an object of the class is destroyed. Accessor and mutator functions for the movie name and MPAA rating A function addRating that takes an integer as an input parameter. The function should verify that the parameter is a number between 1 and 5, and if so, increment the number of people rating the movie that match 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 1. If the user entered a parameter value not between 1 and 5, he/she should be prompted to re-enter a correct value. A function getAverage that returns the average value for all of the movie ratings. (Separate the class code into a header file (Movie.h) and an implementation file (Movie.cpp). b). (30pts) Test the class by writing a main function that creates an array of three movie objects by calling the constructor, adds at least five ratings for each movie (ideally the ratings are from the user input), and outputs the movie name, MPAA rating, and average rating for each movie object
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started