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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started