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;
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();
}
}
Comments
Leave a comment