Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Movie Class Program Using Visual Studios . O O O In this lab, you will design and implement a class in C++, and learn

C++ Movie Class Program Using Visual Studiosimage text in transcribedimage text in transcribedimage text in transcribed

. O O O In this lab, you will design and implement a class in C++, and learn to declare and work with multiple instances of that class. More specifically, this lab will require you to define attributes, methods (including both inline and regularly defined functions), and overloaded constructors. Your Program For your class, you will begin by declaring a class to define a Movie object. Class Movie should have the following members: Private: A string to store the title of the movie. o A string to store the genre of the movie. An integer to store the running time of the movie (in minutes) A double to store an average review score Public: Accessors and Mutators (gets and sets) for each of the private attributes. These can be done inline EXCEPT for the mutator for review. The mutator for review score should make sure that the review is set to a value between 0.0 and 100.0. If the score is outside that range, display an error message and do not change the value. Else, update the review score to the new intended value. Constructors: The default constructor should be implemented. It will initialize the strings for title and genre to empty strings (""), and the integer and double for runtime and rating to 0. A constructor that accepts a single string argument to set the title of the movie. It should initialize the other values to their defaults as mentioned above. A constructor that accepts a string for the title, a string for the genre, an integer for the running time, and a double for the review score. The review score should STILL be subject to the restrictions on its value, just as though we used the mutator. In fact, you can (and should) use the mutator to make sure that those restrictions are preserved. o Other Methods A display method, which will print out all of the information pertaining to the movie as a small info card, similar to what can be seen in the sample screenshot. This method should be defined outside of the class, not inline. . Note: While the next part of the program has you use your ass, you should be testing it incrementally as you add parts. Don't wait to test it all until the very end. Once the class has been declared, it's time to put it to use in the main, we will declare three objects of type Movie (assuming your class is called Movie). o The first will use the default constructor, starting with none of the four values set. For this first movie, prompt the user to enter the title, genre, running time, and score, and use the mutator methods to set those values. After gathering all four pieces of information, call the object's display() function to print out the information. The second object will use the single string constructor. o Since the new object already has its title set, prompt the user for the other three pieces of information, then call the display function to print out that movie's information. The third object will use the four item constructor, passing in initial values for the title, genre, running time, and review. o Because all of the values of this movie are already set, simple call the display function to print it out, and see the results. Sample Output Screenshot Movie 1 - Default Constructor Enter a title for movie1: The Matrix Enter The Matrix's genre: Sci-fi Enter The Matrix's runtime (in minutes): 150 Enter The Matrix's Rotten Tomatoes review: 88 Title: The Matrix Genre: Sci-fi Running Time (in minutes): 158 Rotten Tomatoes Review: 88% Movie 2 - Title Only Constructor. Enter Equilibrium's genre: Thriller Enter Equilibrium's runtime (in minutes): 107 Enter Equilibrium's Rotten Tomatoes review: 42 Title: Equilibrium Genre: Thriller Running Time (in minutes): 107 Rotten Tomatoes Review: 40% movie 3 - A11 data set in constructor Title: Trick'r treat Genre: Thriller Running Time (in minutes): 109 Rotten Tomatoes Review: 84% 2. Press any key to continue

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

=+How might these stem from country and regional cultures?

Answered: 1 week ago