Answer to Question #159426 in C++ for Earl

Question #159426

You are creating a program for the owner of a small museum. They charge $10 for adults, $8 for seniors, and $5 for children. Ask the owner to enter the # of tickets (of each type) sold that day and then calculate both the total per ticket type and the grand total for the day. All user input should occur in one line.

 

Output:

How many Adult, Senior, and Child tickets were sold today? (separate numbers using spaces):   [assume input is 10 10 10]

Revenue from Adult ticket sales is $100

Revenue from Senior ticket sales is $80

Revenue from Child ticket sales is $50

Total revenue for today is $230


1
Expert's answer
2021-01-30T09:33:02-0500
#include <iostream>
using namespace std;
int main()
{
	int a, s, c;
	cout << "How many Adult, Senior, and Child tickets were sold today?\n";
	cin >> a >> s >> c;
	a = a * 10;
	s = s * 8;
	c = c * 5;
	cout << "Revenue from Adult ticket sales is $" << a << endl;
	cout << "Revenue from Senior ticket sales is $" << s << endl;
	cout << "Revenue from Child ticket sales is $" << c << endl;
	cout << "Total revenue for today is $" << a + s + c<<endl;
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog