Using Switch statement, develop application that displays the following menu for the food items available to take order from the customer:
B= Burger
F= French Fries
P= Pizza
S= Sandwiches
I = Ice-cream
The program inputs the type of food and quantity. It finally displays the total charges for the order according to following criteria:
Burger = Rs. 220
French Fries= Rs. 50
Pizza= Rs. 300
Sandwiches= Rs. 150
Ice-cream = Rs. 90
Answers
Answer:
#include <stdio.h>
int main()
{
printf("B=Burger\nF=french fries\nP=pizza\nS=sandwich\nI=icecream\n");
printf("Enter what you want___");
char dish;
scanf("%c, &dish");
switch(dish){
case 'B':
printf("Burger__Rs_220");
break;
case 'F':
printf("french fries__Rs_50");
break;
case 'P':
printf("pizza__ Rs_300");
break;
case 'S':
printf("sand witch__Rs_150");
break;
case 'I':
printf("ice cream____Rs_90");
break;
default:
printf("INVALID OPTION");
}
return 0;
}
Explanation:
This is the answer of this question.
Explanation:
using C programming language'
#include <stdio.h>
int main()
{
printf("B=Burger\nF=french fries\nP=pizza\nS=sandwich\nI=icecream\n");
// printing food items
printf("Enter what you want___");
// asking user what you want
char dish;
scanf("%c, &dish");
switch(dish) // it changes the dish
{
case 'B':
printf("Burger__Rs_220");
break;
case 'F':
printf("French fries__Rs_50");
break;
case 'P':
printf("Pizza__ Rs_300");
break;
case 'S':
printf("Sandwich__Rs_150");
break;
case 'I':
printf("Ice cream____Rs_90");
break;
default:
printf("INVALID OPTION"); // if the selected option is invalid
}
return 0;
}
this is the program using switch statements
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.
The break statement terminates the execution of the nearest enclosing do , for , switch , or while statement in which it appears. Control passes to the statement that follows the terminated statement.
to learn more about switch statements :
https://brainly.in/question/8894958
#SPJ2