In: Computer Science
Using Coding langues C ++
----------------------------------------
There are three seating categories at a stadium. For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales. Format your dollar amount in fixed-point notation, with two decimal places of precision, and be sure the decimal point is always displayed.
Source Code:
#include <iostream>
using namespace std;
int main()
{
int
classA_seats=0,classB_seats=0,classC_seats=0;
float total_income=0.0;
cout<<"How many class A seats are
sold:";
cin>>classA_seats;
cout<<"How many class B seats are sold:";
cin>>classB_seats;
cout<<"How many class C seats are sold:";
cin>>classC_seats;
total_income = classA_seats*15 +
classB_seats*12 + classC_seats*9;
printf("Toatl income generated from ticket sales:$
%.2f\n",total_income);
return 0;
}