c++ restaurant menu

this is what i have done for the restaurant menu on c++ .

#include <iostream>
#include <cctype>
#include <cstdlib>
#include <iomanip>


using namespace std;


int main()
{
char choice='Y';

int order = 1;

int num1=0, num2=0, num3=0, num4=0, num5=0, num6=0;
int num_customers;
int sentinel=0;
const double UnitPrice1= 5.50, UnitPrice2= 4.00,UnitPrice3= 7.50, UnitPrice4= 6.50, UnitPrice5= 7.00, UnitPrice6= 5.00;
double AmountofSale1=0, AmountofSale2=0, AmountofSale3=0, AmountofSale4=0, AmountofSale5=0, AmountofSale6=0;


cout<<" ************ CafeCorner Restaurant ************ \n\n "


<<" ___________________Menu________________\n\n"
<<" Breakfast (6:30am-10:00am)\n\n"
<<"(1) English breakfast(bread & butter,boiled egg and juice) RM5.50\n"
<<"(2) Malaysia Nasik Lemak with Teh Tarik RM 4.00\n\n"
<<" Lunch (11:00am-2:30pm)\n\n"
<<"(3) Set Lunch 1 – Rice, vegetable and sweet sour fish RM7.50\n"
<<"(4) Set Lunch 2 – Chicken rice RM6.50\n\n"
<<" Dinner (6:00pm-8:30pm)\n\n"
<<"(5) Spaghetti Bolognese RM7.00\n"
<<"(6) 1,2,3 RM5.00\n";

while (order != sentinel)
{
cout<<"From the list of food, what would you like:\n";
cin>>order;
switch(order)
{

case 0:
break;

case 1:

cout<<"How many English Breakfast (bread & butter,boiled egg and juice) would you like to order:\n";
cin>>num1;

AmountofSale1 = UnitPrice1 * num1;
break;




case 2:
cout<<"How many Malaysia Nasik Lemak with Teh Tarik would you like to order:\n";
cin>>num2;

AmountofSale2= UnitPrice2 * num2;
break;


case 3:
cout<<"How many Set Lunch 1 – Rice, vegetable and sweet sour fish would you like to order:\n";
cin>>num3;

AmountofSale3= UnitPrice3 * num3;
break;



case 4:
cout<<"How many Set Lunch 2 – Chicken rice would you like to order:\n";
cin>>num4;

AmountofSale4= UnitPrice4 * num4;
break;



case 5:
cout<<"How many Spaghetti Bolognese would you like to order:\n";
cin>>num5;

AmountofSale5= UnitPrice5 * num5;
break;

case 6:
cout<<"How many 1,2,3 would you like to order:\n";
cin>>num6;

AmountofSale4= UnitPrice6 * num6;
break;


default: cout<<"Please choose a valid item from our list\n";
}


{

what should i do if i would like to print the total price? also, if a customer orders more than 1 item,10% discount will be given,if more than 2 item,15% discount will be given. How do i do that?
what should i do if i would like to print the total price?
AmountofSaleTotal = AmountofSale1 + AmountofSale2 + AmountofSale3 + AmountofSale4 + AmountofSale5 + AmountofSale6;
if a customer orders more than 1 item...
1
2
3
4
5
6
7
8
9
10
int cnt = 0;
cnt += num1 ? 1 : 0;
cnt += num2 ? 1 : 0;
cnt += num3 ? 1 : 0;
cnt += num4 ? 1 : 0;
cnt += num5 ? 1 : 0;
cnt += num6 ? 1 : 0;
float discnt = 0;
if (cnt > 2) discnt = 0.15;
else if (cnt > 1) discnt = 0.1;


Advice: using arrays.
1
2
3
int num[6] = {0, 0, 0, 0, 0, 0};
const double UnitPrice[6] = {5.50, 4.00, 7.50, 6.50, 7.00, 5.00};
...
Last edited on
Topic archived. No new replies allowed.