//Amari Mosley CSC5 Chapter 3, P. 143, #5
//
/**************************************************************
*
* Box Office
* ____________________________________________________________
* This program calculates a theater's gross and net box office
* profit for a night based on ticket sales.
*
Computation is based on the following formulas:
* Gross Profit = (Adult Tickets * 6.00) + (Child Tickets * 3.00)
* Net Profit = Gross Profit * 0.20
* Amount Paid to Distributor = Gross Profit - Net Profit
* ____________________________________________________________
* INPUT
* movieName, adultTickets, childTickets
* OUTPUT
* grossProfit, netProfit, amountPaidToDistributor
*
**************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// Defining Main Function
int main() {
// Define variables
string movieName;
int adultTickets, childTickets;
double grossProfit, netProfit, amountPaidToDistributor;
// Constants for ticket prices and theater percentage
const double ADULT_TICKET_PRICE = 6.00;
const double CHILD_TICKET_PRICE = 3.00;
const double THEATER_PERCENTAGE = 0.20;
// Ask for the name of the movie
cout << "Enter the name of the movie: ";
getline(cin, movieName);
// Ask for the number of adult and child tickets sold
cout << "Enter the number of adult tickets sold: ";
cin >> adultTickets;
cout << "Enter the number of child tickets sold: ";
cin >> childTickets;
// Calculate profits
grossProfit = (adultTickets * ADULT_TICKET_PRICE) + (childTickets * CHILD_TICKET_PRICE);
netProfit = grossProfit * THEATER_PERCENTAGE;
amountPaidToDistributor = grossProfit - netProfit;
// Display the report formatted to match the required output[cite: 4]
cout << "\n";
cout << left << setw(30) << "Movie Name:" << "\"" << movieName << "\"" << endl;
cout << left << setw(30) << "Adult Tickets Sold:" << adultTickets << endl;
cout << left << setw(30) << "Child Tickets Sold:" << childTickets << endl;
// Format numeric output for currency and align the decimals[cite: 4]
cout << fixed << setprecision(2);
cout << left << setw(30) << "Gross Box Office Profit:" << "$ " << right << setw(7) << grossProfit << endl;
cout << left << setw(30) << "Net Box Office Profit:" << "$ " << right << setw(7) << netProfit << endl;
cout << left << setw(30) << "Amount Paid to Distributor:" << "$ " << right << setw(7) << amountPaidToDistributor << endl;
return 0;
}