A food court facilitates their customers with a featured App where the customers can view the Menu Card and place their order. The order may be delivered on-premises or off-premises as per policies. Write a code to take the order from the customer by pressing menu number & Quantity. Final Output should be the calculated total amount. Menu card is given as:
OUTPUT FOR THE PROGRAM |
1 Veg Sandwich 80
2 Cheese Sandwich 130
3 Veg Grilled Sandwich 100
4 Sada Dosa 80
5 Masala Dosa 90
6 Onion Rava Sada Dosa 110
7 Onion Rava Masala Dosa 120
8 Spring Dosa 140
9 Plain Uttapam 70
10 Onion Uttapam 80
#include<iostream>
using namespace std;
int M,Q,Total;
string ans;
string Menu[]={"Veg Sandwich","Cheese Sandwich","Veg Grilled Sandwich","Sada Dosa","Masala Dosa","Onion Rava Sada Dosa","Onion Rava Masala Dosa","Spring Dosa","Plain Uttapam","Onion Uttapam"};
float Price[]={80.0,130.0,100.0,80.0,90.0,110.0,120.0,140.0,70.0,80.0};
void Display()
{
cout<<"Number\t"<<"Name\t\t\t\t"<<"Price\n";
for(int i=0;i!=10;i++)
{
cout<<i+1<<"\t"<<Menu[i]<<"\t\t\t"<<Price[i]<<"\n";
}
cout<<"\n";
}
void get()
{
cout<<"Enter Menu Number: ";
cin>>M;
cout<<"Enter Quantity: ";
cin>>Q;
}
int main()
{
Display();
do
{
get();
Total +=Price[M-1]*Q;
cout<<"Do you want to continue(y/n): ";
cin>>ans;
}
while(ans=="y");
cout<<"Total is: "<<Total<<"\n";
return 0;
}
/* ***********OUTPUT***************
Number Name Price
1 Veg Sandwich 80
2 Cheese Sandwich 130
3 Veg Grilled Sandwich 100
4 Sada Dosa 80
5 Masala Dosa 90
6 Onion Rava Sada Dosa 110
7 Onion Rava Masala Dosa 120
8 Spring Dosa 140
9 Plain Uttapam 70
10 Onion Uttapam 80
Enter Menu Number: 1
Enter Quantity: 2
Do you want to continue(y/n): y
Enter Menu Number: 3
Enter Quantity: 2
Do you want to continue(y/n): n
Total is: 360
--------------------------------
For more such posts click the link:-http://svencrai.com/G8W