//Sam Trivikraman CS1A Chapter 11, p. 645, #2
//
/*
******************************************************************************
Store Movie Data (Question 1 modded)
_______________________________________________________________________________
This program stores user inputted movie data.
_______________________________________________________________________________
INPUT
movie title : The title of the movie
movie director : The director of the movie
movie release year : The movie's release year
movie run time : The movie's run time
movie production cost : The movie's production cost
movie revenue : The movie's revenue
OUTPUT
array of movie details : An array that stores all of the details for the movie
_______________________________________________________________________________
*******************************************************************************
*/
#include <iostream>
using namespace std;
//a structure that stores all of the movie data
struct MovieData
{
string title; //INPUT movie title
string director; //INPUT movie director
int yearReleased; //INPUT movie release year
int runTime; //INPUT movie run time
float prodCost; //INPUt movie production cost
float revenue; //INPUT movie revenue
};
int main() {
MovieData movieOne; //OUTPUT the first movie
MovieData movieTwo; //OUTPUT the second movie
float movieOneMoney; //OUTPUT the profit/loss for movie one
float movieTwoMoney; //OUTPUT the profit/loss for movie two
//get the details for movie one and input into the array
cout << "Please enter the title of the first movie" << endl;
cin >> movieOne.title;
cout << "Please enter the director of the first movie" << endl;
cin >> movieOne.director;
cout << "Please enter the year that the first movie was released" << endl;
cin >> movieOne.yearReleased;
cout << "Please enter the first movie's run time (in minutes)" << endl;
cin >> movieOne.runTime;
cout << "Please enter the production cost of the first movie" << endl;
cin >> movieOne.prodCost;
cout << "Please enter the revenue from the first movie" << endl;
cout << "\n" << endl;
//calculate and output profit/loss for movie one
movieOneMoney = movieOne.revenue - movieOne.prodCost;
if(movieOneMoney > 0)
{
cout << "This year's profit is: $" << movieOneMoney << endl;
}
else
{
cout << "This year's loss is: $" << movieOneMoney << endl;
}
cout << "\n" << endl;
//get the details for movie two and input into the array
cout << "Please enter the title of the second movie" << endl;
cin >> movieTwo.title;
cout << "Please enter the director of the second movie" << endl;
cin >> movieTwo.director;
cout << "Please enter the year that the second movie was released" << endl;
cin >> movieTwo.yearReleased;
cout << "Please enter the second movie's run time (in minutes)" << endl;
cin >> movieTwo.runTime;
cout << "Please enter the production cost of the second move" << endl;
cin >> movieTwo.prodCost;
cout << "Please enter the revenue from the second movie" << endl;
cin >> movieTwo.revenue;
cout << "\n" << endl;
//calculate and output profit/loss for movie two
movieTwoMoney = movieTwo.revenue - movieTwo.prodCost;
if(movieTwoMoney > 0)
{
cout << "This year's profit is: $" << movieTwoMoney << endl;
}
else
{
cout << "This year's loss is: $" << movieTwoMoney << endl;
}
//output the details for movies one and two
cout << "\n" << endl;
cout << "Movie One details: " << endl;
cout << "Title: " << movieOne.title << endl;
cout << "Director: " << movieOne.director << endl;
cout << "Release Year: " << movieOne.yearReleased << endl;
cout << "Run Time: " << movieOne.runTime << endl;
cout << "Movie Two details: " << endl;
cout << "Title: " << movieTwo.title << endl;
cout << "Director: " << movieTwo.director << endl;
cout << "Release Year: " << movieTwo.yearReleased << endl;
cout << "Run Time: " << movieTwo.runTime << endl;
return 0;
}