-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstadiumseating.cpp
More file actions
35 lines (24 loc) · 1.07 KB
/
stadiumseating.cpp
File metadata and controls
35 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//stadium seating program. Oladamola Ola-Buraimo. 03/4/24. This code will take user input for 3 types of tickets sold, and display income generated.
#include <iostream>
#include <iomanip>
using namespace std;
double calculateIncome(int classATickets, int classBTickets, int classCTickets) {
const double classAPrice = 15.0;
const double classBPrice = 12.0;
const double classCPrice = 9.0;
double totalIncome = (classATickets * classAPrice) + (classBTickets * classBPrice) + (classCTickets * classCPrice);
return totalIncome;
}
int main() {
int classATickets, classBTickets, classCTickets;
cout << "Enter the number of Class A tickets sold: ";
cin >> classATickets;
cout << "Enter the number of Class B tickets sold: ";
cin >> classBTickets;
cout << "Enter the number of Class C tickets sold: ";
cin >> classCTickets;
double totalIncome = calculateIncome(classATickets, classBTickets, classCTickets);
cout << fixed << setprecision(2);
cout << "Total income generated from ticket sales: $" << totalIncome << endl;
return 0;
}