Question #124368

2. Write a program that computes the total ticket sales of a concert . there are three types of seating’s : A, B, and C. the program accepts the number of tickets sold and the price of a ticket for each of the three types of seats. The total sales are computed as

totalSales = numberofA_Seats * priceperA_Seat +

numberofB_Seats * priceperB_Seat +

numberofC_Seats * priceperC_Seat ;

Write this program, using only one class, the main class of the program

Expert's answer

#include <iostream>


int main() {
	std::cout << "How many type A tickets sold?" << std::endl;
	int numberofA_Seats;
	std::cin >> numberofA_Seats;
	std::cout << "How much does one such ticket cost?" << std::endl;
	int priceperA_Seat;
	std::cin >> priceperA_Seat;


	std::cout << "How many type B tickets sold?" << std::endl;
	int numberofB_Seats;
	std::cin >> numberofB_Seats;
	std::cout << "How much does one such ticket cost?" << std::endl;
	int priceperB_Seat;
	std::cin >> priceperB_Seat;


	std::cout << "How many type C tickets sold?" << std::endl;
	int numberofC_Seats;
	std::cin >> numberofC_Seats;
	std::cout << "How much does one such ticket cost?" << std::endl;
	int priceperC_Seat;
	std::cin >> priceperC_Seat;


	int  totalCost = numberofA_Seats * priceperA_Seat +
		numberofB_Seats * priceperB_Seat +
		numberofC_Seats * priceperC_Seat;


	std::cout << "Total cost: " << totalCost << std::endl;


	system("pause");
	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!

LATEST TUTORIALS
APPROVED BY CLIENTS