Answer to Question #329673 in Java | JSP | JSF for Linnie

Question #329673

Write a program that computes the total ticket sales of a concert. There are three types of seating’s: A, B, and C and the price of a ticket for each of the three types of seats are 3000 Rs ,2000 Rs , and 1000 Rs respectively. The program accepts the number of tickets sold in each category. The total sales are computed as follows:

totalSales = numberOfA_Seats * pricePerA_Seat + numberOfB_Seats * pricePerB_Seat + numberOfC_Seats * pricePerC_Seat;


1
Expert's answer
2022-04-17T07:41:14-0400




import java.util.Scanner;


class App {




	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		final int pricePerA_Seat=3000;
		final int pricePerB_Seat=2000;
		final int pricePerC_Seat=1000;
		System.out.print("Ente the number of tickets sold in category A: ");
		int  numberOfA_Seats = keyBoard.nextInt();
		System.out.print("Ente the number of tickets sold in category B: ");
		int  numberOfB_Seats = keyBoard.nextInt();
		System.out.print("Ente the number of tickets sold in category C: ");
		int  numberOfC_Seats = keyBoard.nextInt();
		int totalSales = numberOfA_Seats * pricePerA_Seat + numberOfB_Seats * pricePerB_Seat + numberOfC_Seats * pricePerC_Seat;
	    System.out.println("The total ticket sales of a concert: "+totalSales);
		keyBoard.close();
	}
}

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