using computer programming c Using Switch Statements write a

using computer programming 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

Solution

#include <stdio.h>

int main()
{
char seat;
int number;
printf(\"Seat tickets menu:\ B=Balcony\ F=Front\ A=Randomseat\ R=Rear\ \");
printf(\"Enter the type of seat:\ \");
scanf(\"%c\",&seat); //prompting user to enter type of seat
printf(\"Enter number of seats:\ \");
scanf(\"%d\",&number); //prompting user to enter number of seats
switch(seat){ //passing type of seat to switch statement
case \'B\':
number=number*200; //caluculating the total charge of seats
printf(\"Tota charge for you order:%d\",number);
printf(\"\ \");
break;
case \'F\':
number=number*500;
printf(\"Tota charge for you order:%d\",number);
printf(\"\ \");
break;
case \'A\':
number=number*100;
printf(\"Tota charge for you order:%d\",number);
printf(\"\ \");
break;
case \'R\':
number=number*150;
printf(\"Tota charge for you order:%d\",number);
printf(\"\ \");
break;
}

  
}

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site