Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ For your class, you will begin by declaring a class to define a Movie object. Class Movie should have the following members: Private:

In C++

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.
    • A string to store the genre of the movie.
    • An integer to store the running time of the movie (in minutes)
      • This value should be initialized to 0.
    • A double to store an average review score
      • This value should be initialized to 0.0
  • 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 initialized the other values to defaults as mentioned in the default constructor.
      • 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 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.
    • 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.

Once the class has been declared, its time to put it to use. In the main, we will declare three objects of type Movie (assuming your class is called Movie).

  • 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 mutators to set those values.
    • After gathering all four pieces of information, call the objects display() function to print out the information.
  • The second object will use the single string constructor.
    • 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 movies information.
  • The third object will use the four item constructor, passing in initial values for the title, genre, running time, and review.
    • Because all of the values of this movie are already set, simple call the display function to print it out, and see the results.

//Please add detailed comments, as I have not been able to understand the proper way to implement the code.

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

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

More Books

Students also viewed these Databases questions

Question

Discuss the points covered by the introduction of a report.

Answered: 1 week ago

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago