Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago