Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using computer programming c not c+ Using Switch Statements, write a program tha

ID: 3928110 • Letter: U

Question

using computer programming c not c+ Using Switch Statements, write a program that displays the following menu for the seat ticket options available to the customer:

• B= Balcony • F= Front • A= Random Seat • R= Rear The user inputs the type of seat and quantity. It finally displays the total charges for the order according to following criteria:

• Balcony = $ 200 • Random Seat = $ 100 • Front = $ 500 • Rear = $ 150

sample output: *** B: Balcony <$200> *** *** F: Front <$ 500> *** *** A: Random Seat < $100> *** *** R: Rear < $150 >*** Please make a choice : R Please enter the number of tickets: 5 You selected Rear Your total is $750

Explanation / Answer

Code:

#include <stdio.h>

int main(void) {
   // your code goes here
   int numtckt,totalcst=0;
   char choice;
   printf(" *** B: Balcony <$200> *** *** F: Front <$ 500> *** *** A: Random Seat < $100> *** *** R: Rear < $150 >*** ");
   printf(" Please make a choice: ");
   scanf("%c",&choice);
   printf(" Please enter the number of tickets: ");
   scanf("%d",&numtckt);
   switch(choice){
       case 'B':printf(" You selected Balcony Your total is $%d",(200*numtckt));break;
       case 'F':printf(" You selected Front Your total is $%d",(500*numtckt));break;
       case 'A':printf(" You selected Random Seat Your total is $%d",(100*numtckt));break;
       case 'R':printf(" You selected Rear Your total is $%d",(150*numtckt));break;
       default:printf("Worng choice");break;
   }
  
   return 0;
}

Output: