Computer Science, asked by amirakhan909078, 9 hours ago

Question 7: Using switch-case statements only, write a C++ program that displays the following the food items available to take orders from the customer: (10 marks) • Burgers • Pizzas • San When the user selects one of the options, a further submenu is displayed according to the chosen option. The online food shop offers Crispy Chicken Burger (600 Rs.), Beef Burger (650 Rs.), and Fish Burger (700 Rs.) in the Burger category; Chicken tikka, Chicken Fajita and Four Seasons in the Pizza category; whereas Club (300 Rs.), Chicken (325 Rs.), and Vegetables (315 Rs.) in the Sandwiches category. Prices of each food is also displayed to the user in the selected sub menu. The user will select the food item and quantity of the item. In case of the Pizza items, the user can also select the size of pizzas (l.e. Small (850 Rs.), item Campus Medium (1200 Rs.), and Large (1600 Rs.)). The program outputs the total charges according to the chosen options.​

Answers

Answered by shaikhsahil66
0
I don’t know but I will try
Answered by shilpa85475
0

The online food shop offers Crispy Chicken Burger (600 Rs.), Beef Burger (650 Rs.), and Fish Burger (700  Rs.) in the Burger category; Chicken tikka, Chicken Fajita and Four Seasons in the Pizza category; whereas  Club (300 Rs.), Chicken (325 Rs.), and Vegetables (315 Rs.) in the Sandwiches category.

Prices of each food  item is also displayed to the user in the selected sub-menu. The user will select the food item and quantity  of the item.

In the case of the Pizza items, the user can also select the size of pizzas (i.e. Small (850 Rs.), Medium (1200 Rs.), and Large (1600 Rs.)).  

Explanation:

#include <iostream>

using namespace std;

int main()

{

   cout<<"\nChoose an option: ";

   cout<<"\n1. Burgers\n2. Pizzas\n3. Sandwiches\n";

   int c;

   cin>>c;

   double price;

   switch(c){

       case 1:

           int c2;

           cout<<"\nChoose an option:";

           cout<<"\n1. Crispy Chicken Burger (600 Rs.):";

           cout<<"\n2. Beef Burger (650 Rs.):";

           cout<<"\n3. Fish Burger (700 Rs.):\n";

           cin>>c2;

           int n;

           cout<<"\nEnter number of items: ";

           cin>>n;

           switch(c2){

               case 1:

                   price=600*n;

                   break;

               case 2:

                   price=650*n;

                   break;

               case 3:

                   price=700*n;

                   break;

               default:

                   cout<<"\nInvalid choice";

           }

           break;

       case 2:

           int c3;

           cout<<"\nChoose an option: ";

           cout<<"\n1. Chicken tikka \n2. Chicken Fajita \n3. Four Seasons\n";

           cin>>c3;

           int n1;

           cout<<"\nEnter number of items: ";

           cin>>n1;

           switch(c3){

               case 1:

                   price=850*n1;

                   break;

               case 2:

                   price=1200*n1;

                   break;

               case 3:

                   price=1600*n1;

                   break;

               default:

                   cout<<"\nInvalid choice";

           }

           break;

       case 3:

           int c4;

           cout<<"\nChoose an option: ";

           cout<<"\n1. Club (300 Rs.) \n2. Chicken (325 Rs.) \n3. Vegetables (315 Rs.)\n";

           cin>>c4;

           int n2;

           cout<<"\nEnter number of items: ";

           cin>>n2;

           switch(c4){

               case 1:

                   price=300*n2;

                   break;

               case 2:

                   price=325*n2;

                   break;

               case 3:

                   price=315*n2;

                   break;

               default:

                   cout<<"\nInvalid choice";

           }

           break;

       default:

           cout<<"\nInvalid choice";

   }

   cout<<"\nTotal Price: "<<price;

   return 0;

}

Similar questions