Question: please help with this c++ program Thank you Write the interface ( Movie.h ) and the implementation ( Movie.cpp ) of the class Movie according

please help with this c++ program Thank you

Write the interface (Movie.h) and the implementation (Movie.cpp) of the class Movie according to the requirements listed below:

  • Member variables
    • Title of the movie stored as a string
    • Year when the movies was released stored as an int
  • Default constructor
  • Overloaded constructor
    • Parameter: A string storing a movie title and an int storing the year when the movie was released
  • Function getMovieTitle
    • Returns the name of the movie.
  • Function getYear
    • Returns the year when the movie was released.
  • Function setMovieTitle
    • Parameter: a string storing a movie title
    • Replaces the name of the movie stored in the calling object with the name passed by the parameter.
  • Function setYear
    • Parameter: an int storing a year
    • Replaces the year of the movie stored in the calling object with the year passed by the parameter.
  • Function print
    • Prints the movie title and the year in this format: Title (year)
  • Function sameYear
    • Parameter: An object of the class Movie
    • Compares the year of the movie stored in the calling object to the year of the movie passed by the parameter object.
    • Returns true if the year when they were released are the same, false otherwise.
  • Destructor
    • Left empty.

Use this Main.cpp file to test your Movie class. Your output MUST look EXACTLY as shown below (note that you need to pay attention to spaces, punctuation, capital letters, etc.).

#include "Movie.h"

#include

#include

using namespace std;

int main()

{

//create an object of the Movie class

//use overloaded constructor

Movie movie1("Jurassic World", 2015)

;//test function

getNamecout << "Movie 1: " << movie1.getMovieTitle() << endl;

//test function getYear

if (movie1.getYear() == 0)

cout << "No data available." << endl;

else

cout << "Released in: " << movie1.getYear() << endl;

//test functions setName and setYear

movie1.setMovieTitle("Deadpool");

movie1.setYear(2016);

//create another three objects of the Movie class

Movie movie2("Zootopia", 2016);

Movie movie3("John Wick", 2014);

Movie movie4("John Wick: Chapter 2", 2017);

//test function print

cout << " Movie 1 - ";

movie1.print();

cout << " Movie 2 - ";

movie2.print();

cout << " Movie 3 - ";

movie3.print();

cout << " Movie 4 - ";

movie4.print();

cout << endl;

//test function sameYear

if (movie1.sameYear(movie2))

cout << " Movie 1 and movie 2 were released the same year.";

else

cout << " Movie 1 and movie 2 were NOT released the same year.";

if (movie1.sameYear(movie3))

cout << " Movie 1 and movie 3 were released the same year.";

else

cout << " Movie 1 and movie 3 were NOT released the same year.";

if (movie1.sameYear(movie4))

cout << " Movie 1 and movie 4 were released the same year. ";

else

cout << " Movie 1 and movie 4 were NOT released the same year.";

// ---------------------------------------LEAVE A BLANK LINE

//create an object of the Movie class using the default constructor

Movie movie5;cout << " Movie 5: " << movie5.getMovieTitle() << endl;

if (movie5.getYear() == 0)

cout << "No data available." << endl;

else

cout << "Released in: " << movie5.getYear() << endl;

movie5.setMovieTitle("Fight Club");

movie5.setYear(1999);

movie5.print();

cout << endl;

cout << endl;

return 0;

}

-----------------------------------------------------------------------------------------------------------------

Movie 1: Jurassic World Released in: 2015 Movie 1 - Deadpool (2016) Movie 2 - Zootopia (2016) Movie 3 - John Wick (2014) Movie 4 - John Wick: Chapter 2 (2017) Movie 1 and movie 2 were released the same year. Movie 1 and movie 3 were NOT released the same year. Movie 1 and movie 4 were NOT released the same year. Movie 5: No name assigned. No data available. Fight Club (1999)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!