// Nicolas Ruano CS1A Chapter 3, Pp. 143, #5
/*******************************************************************************
* CALCULATING THE BOX OFFICE AND THE TICKET PRICES
* ____________________________________________________________________________
* This program calculates the revenue from adult and child tickets sold,
* and determines the theater’s profit and the distributor’s share.
*
* FORMULAS:
* total = (adult_tkt * ADULT_PRICE) + (child_tkt * CHILD_PRICE)
* theater_profit = total * PROFIT
* distributor_profit = total - theater_profit
* ____________________________________________________________________________
* INPUT
* adult_tkt : Number of adult tickets sold
* child_tkt : Number of child tickets sold
* movie_name : Name of the movie
*
* OUTPUT
* total : Total money earned from ticket sales
* theater_profit : Profit kept by the theater
* distributor_profit : Profit given to the distributor
******************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
// CONSTANT VARIABLES
const float ADULT_PRICE = 6.00;
const float CHILD_PRICE = 3.00;
const float PROFIT = 0.20; // Theater keeps 20%
// Variables
string movie_name;
int adult_tkt, child_tkt;
float total, theater_profit, distributor_profit;
// Ask the name of the movie
cout << "What is the name of the movie? ";
getline(cin, movie_name);
// Ask how many tickets are sold
cout << "How many adult tickets were sold? ";
cin >> adult_tkt;
cout << "How many child tickets were sold? ";
cin >> child_tkt;
// Calculate totals
total = (adult_tkt * ADULT_PRICE) + (child_tkt * CHILD_PRICE);
theater_profit = total * PROFIT;
distributor_profit = total - theater_profit;
// Display the report
cout << fixed << setprecision(2);
cout << "\nMovie Name: \"" << movie_name << "\"" << endl;
cout << "Adult Tickets Sold: " << setw(10) << adult_tkt << endl;
cout << "Child Tickets Sold: " << setw(10) << child_tkt << endl;
cout << "Total Box Office: $" << setw(10) << total << endl;
cout << "Theater Profit: $" << setw(10) << theater_profit << endl;
cout << "Distributor Profit: $" << setw(10) << distributor_profit << endl;
return 0;
}