Answer to Question #124425 in C++ for Opoku Evans

Question #124425
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.
1
Expert's answer
2020-06-30T07:59:46-0400
#include<iostream>
using namespace std;
class concerttickets
{
	float price;  // price of each ticket
	float number;  // number of the tickets
	float totalSale; // total sale
	public:
		float a;  //seats of A
		float b;  //seats of B
		float c;  //seats of C
		float x;  //price of seat A
		float y;  //price of seat B
		float z;  //price of seat C 
	    float totalSales()
		{
			totalSale = a*x + b*y + c*z ;   // total sale
			cout << "Total Sale of the concert  " << totalSale << endl;
			 
		}
};
int main()
{


	concerttickets ct;
	
	cout <<"Enter the number of seat of A \n" ;
	cin >> ct.a;
	cout <<"Enter the number of seat of B \n" ;
	cin >> ct.b;
	cout <<"Enter the number of seat of C \n" ;
	cin >> ct.c;
	cout <<"Enter the price of seat of A \n" ;
	cin >> ct.x;
	cout <<"Enter the price of seat of B \n" ;
	cin >> ct.y;
	cout <<"Enter the price of seat of C \n" ;
	cin >> ct.z;
	ct.totalSales();
}

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
APPROVED BY CLIENTS