Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a class called MovieData to store the following information about a movie

ID: 3555314 • Letter: D

Question

Design a class called MovieData to store the following information about a movie:

Include a constructor that allows all four of these member data values to be specified at the time a MovieData variable is created (use the above order for the parameters). The class should also rovide a member function, print, that displays the information as follows:

Title (Year). Directed by Director. (Running time minutes)

Your main program should do the following things. The program prompts "movie information: " and then reads the title, director, release year and running-time, each typed on a line by itself (use the getline function to read in the title and director strings). The program then creates a MovieData object and uses the object to print the movie information.

Here is one sample run:

movie informtion: Casablanca

Michael Curtiz

1942

102

Casablanca (1942). Directed by Michael Curtiz (102 minutes)

*Please use c++ not c# and if you could leave comments on the code as to what important parts are doing, thatd be great!

Explanation / Answer

Program Code:

// Movie.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class MovieData
{
public:MovieData();
       int print(string title,string director,int year, int time);
};
MovieData::MovieData()
{

}
int MovieData::print(string title,string director,int year, int time)
{
   cout<<title<<"("<<year<<")"<<"."<<"Directed by "<<director<<"("<<time<<"minutes"<<")";
   return 0;
}
int main()
{
   string title, director;
   int year_released,running_time;
   cout<<"movie information";
   getline (std::cin,title);
   getline (std::cin,director);
   cin>>year_released;
   cin>>running_time;
  
   MovieData md;
   md.print(title,director,year_released,running_time);
   system("pause");
   return 0;

}
Output:

movie informtion: Casablanca

Michael Curtiz

1942

102

Casablanca (1942). Directed by Michael Curtiz (102 minutes)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote