// Torrez, Elaine CS1A Chapter 3 P. 143, #2
/******************************************************************************************
*
* CALCULATE STADIUM SEATING INCOME
*
* --------------------------------------------------------------------------------
* This program asks the user to enter the number of Class A, Class B, and Class C
* tickets sold for a softball game. It then calculates and displays the income
* generated from each class of seats as well as the total income from all ticket sales.
* --------------------------------------------------------------------------------
*
* INPUT
* ticketsA : Number of Class A tickets sold
* ticketsB : Number of Class B tickets sold
* ticketsC : Number of Class C tickets sold
*
* OUTPUT
* incomeA : Income from Class A ticket sales
* incomeB : Income from Class B ticket sales
* incomeC : Income from Class C ticket sales
* totalIncome : Total income from all ticket sales
*
*******************************************************************************************/
#include <iostream>
#include <iomanip> // Included for fixed and setprecision
using namespace std;
int main ()
{
// Constants
const double PRICE_A = 15.00; // Price of Class A ticket
const double PRICE_B = 12.00; // Price of Class B ticket
const double PRICE_C = 9.00; // Price of Class C ticket
// Variables (ABC order)
double incomeA; // OUTPUT Income from Class A
double incomeB; // OUTPUT Income from Class B
double incomeC; // OUTPUT Income from Class C
double totalIncome; // OUTPUT Total income
int ticketsA; // INPUT Number of Class A tickets sold
int ticketsB; // INPUT Number of Class B tickets sold
int ticketsC; // INPUT Number of Class C tickets sold
// Get input
cout << "Enter the number of Class A tickets sold: ";
cin >> ticketsA;
cout << "Enter the number of Class B tickets sold: ";
cin >> ticketsB;
cout << "Enter the number of Class C tickets sold: ";
cin >> ticketsC;
// Calculate income
incomeA = ticketsA * PRICE_A;
incomeB = ticketsB * PRICE_B;
incomeC = ticketsC * PRICE_C;
totalIncome = incomeA + incomeB + incomeC;
// Display results
cout << fixed << setprecision(2);
cout << "\nIncome from Class A tickets: $" << incomeA << endl;
cout << "Income from Class B tickets: $" << incomeB << endl;
cout << "Income from Class C tickets: $" << incomeC << endl;
cout << "---------------------------------" << endl;
cout << "Total Income from ticket sales: $" << totalIncome << endl;
return 0;
}