Design a class called MovieData to store the following information about a movie
ID: 3566221 • Letter: D
Question
Design a class called MovieData to store the following information about a movie:
Title (a string )
Director (a string )
Year Released (an integer )
Running time (in minutes - an integer )
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 provide a member function, print, that displays the information as follows:
Title (Year). Directed by Director. (Running time minutes)
Example:
The Good, The Bad and The Ugly (1966). Directed by Sergio Leone. (161 minutes)
Explanation / Answer
class moviedata
{
char title[20],director[20];
int year,running_time;
public:
void moviedata(char*title,char*director,year,running_time);
void print
{
cout<<title<<"("<<year<<").Directed by Director."<<director<<"("<<running_time<<")";
}
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.