FULLY AUTOMATIC VENDING MACHINE dispenses
your cuppa on just press of button.
A vending machine can serve range of products as
follows:
Coffee
1.Espresso Coffee
2.Cappuccino Coffee
3.Latte Coffee
Tea
1.Plain Tea
2.Assam Tea
3. Ginger Tea
4.Cardamom Tea
5.Masala Tea
6.Lemon Tea
7. Green Tea
8. Organic Darjeeling Tea
Soups
1. Hot and Sour Soup
2. Veg Corn Soup
3.Tomato Soup
4.Spicy Tomato Soup
Beverages
1. Hot Chocolate Drink
Answers
Answer:
int main()
{
float result;
int num;
char choice, choice1;
printf("Enter your choice:\n");
choice = input();
choice1=input();
switch (choice) {
case 'c': {
switch(choice1){
case '1':{printf("Welcome to CCD!\n");
printf("Enjoy your Expresso Coffee!");
break;}
case '2':{ printf("Welcome to CCD!\n");
printf("Enjoy your Cappuccino Coffee!");
break;}
case '3':{printf("Welcome to CCD!\n");
printf("Enjoy your Latte Coffee!");
break;}
}
break;
}
case 't': {
switch(choice1){
case '1':{printf("Welcome to CCD!\n");
printf("Enjoy your plain Tea!");
break;}
case '2':{ printf("Welcome to CCD!\n");
printf("Enjoy your Assam Tea!");
break;}
case '3':{printf("Welcome to CCD!\n");
printf("Enjoy your Glinger Tea!");
break;}
case '4':{printf("Welcome to CCD!\n");
printf("Enjoy your Cardamom Tea!");
break;}
case '5':{ printf("Welcome to CCD!\n");
printf("Enjoy your Masala Tea!");
break;}
case '6':{printf("Welcome to CCD!\n");
printf("Enjoy your Leamon Tea!");
break;}
case '7':{printf("Welcome to CCD!\n");
printf("Enjoy your Green Tea!");
break;}
case '8':{ printf("Welcome to CCD!\n");
printf("Enjoy your Organic Darjeeling Tea!");
break;}
}
break;
}
case 's': {
switch(choice1){
case '1':{printf("Welcome to CCD!\n");
printf("Enjoy your Hot and Sour Soup!");
break;}
case '2':{ printf("Welcome to CCD!\n");
printf("Enjoy your Veg Corn Soup!");
break;}
case '3':{printf("Welcome to CCD!\n");
printf("Enjoy your Tomato Soup!");
break;}
case '3':{printf("Welcome to CCD!\n");
printf("Enjoy your Spicy Tomato Soup!");
break;}
}
break;
}
case 'b': {
switch(choice1){
case '1':{printf("Welcome to CCD!\n");
printf("Enjoy your Hot Chocolate Drink!");
break;}
case '2':{ printf("Welcome to CCD!\n");
printf("Enjoy your Badam Drink!");
break;}
case '3':{printf("Welcome to CCD!\n");
printf("Enjoy your Badman-Pista Drink!");
break;}
}
break;
}
default:
printf("INVALID OPTION!\n");
}
return 0;
}
char input()
{
int number;
scanf("%c", &number);
return (number);
}