Question: Convert movie program to array of objects, then make a 5 minuts code review in class n your conversion Below is the movie program to

Convert movie program to array of objects, then make a 5 minuts code review in class n your conversion

Below is the movie program to be converted:

#include

#include

#include

using namespace std;

typedef struct MOVIEDATA

{

string title;

string director;

int yearRel;

float runTime;

float prCosts;

float fRevens;

}

MovieData;

void showMovie(MovieData * movieData)

{

cout << endl << "-------------------------- ";

cout << "Movie Title: " << movieData -> title << endl;

cout << "Director: " << movieData -> director << endl;

cout << "Year Released: " << movieData -> yearRel << endl;

cout << "Running Time (in minutes): " << movieData -> runTime << endl;

if (movieData -> prCosts < movieData -> fRevens)

{

cout << "The first year's profit is: $ " << fixed << setprecision(2) << movieData -> fRevens - movieData-> prCosts << endl;

}

else

{

cout << "The first year's loss is: $ " << fixed << setprecision(2) << movieData -> prCosts - movieData -> fRevens << endl;

}

cout << "--------------------------" << endl;

}

int main(int argc, char** argv)

{

MovieData* firstMovie = new MovieData;

MovieData* secondMovie = new MovieData;

firstMovie -> title = "2001: A Space Odyssey";

firstMovie -> director = "Stanley Kubrick";

firstMovie -> yearRel = 1968;

firstMovie -> runTime = 139;

firstMovie -> prCosts = 10500000;

firstMovie -> fRevens = 146000000;

secondMovie -> title = "Star Wars: Empire Strikes Back";

secondMovie -> director = "George Lucas";

secondMovie -> yearRel = 1980;

secondMovie -> runTime = 124;

secondMovie -> prCosts = 30500000;

secondMovie -> fRevens = 401000000;

showMovie(firstMovie);

showMovie(secondMovie);

return 0;

}

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!