Please help me solve the problem! my request is after finish the order and topping , I need to print receipt and only display what I have order only. what should i change?
Please reply as soon as possible . thank you!
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char ans1; //declaration of add order or not
int order; //declaration of order the meals
int num1=0, num2=0, num3=0, num4=0, num5=0,num6=0; //declaration of the amount that you want to order
int qnum1=0 , qnum2=0 , qnum3=0 , qnum4=0 , qnum5=0 , qnum6=0; //declaration of total up the quantity of order and add order
double total; //declaration of total up all the price
const double UnitPrice1= 7.50, UnitPrice2= 6.75,UnitPrice3= 2.55, UnitPrice4= 2.55, UnitPrice5= 2.10, UnitPrice6= 2.10; //declaration of fix the price inside the menu
double sale1=0, sale2=0, sale3=0, sale4=0, sale5=0, sale6=0; //declaration of total up the price with order
do //loop the statement weather want to add order or not
{
//display the menu to let customer choose
cout<<"**********************************************************************"<<endl;
cout<<"* ********** *** *** **** ** ****** ***********"<<endl;
cout<<"* * ******** * *** *********** * *** ** ****** ***********"<<endl;
cout<<"* ** ****** ** *** ***** ** ** ** ****** ***********"<<endl;
cout<<"* *** **** *** *** *********** *** * ** ****** ***********"<<endl;
cout<<"* **** ** **** *** *********** **** ** ****** ***********"<<endl;
cout<<"* ***** ***** *** *** ***** ** ***********"<<endl;
cout<<"**********************************************************************"<<endl<<endl;
cout<<"======================================================================="<<endl;
cout<<"====MEALS=============================================================="<<endl;
cout<<" (1) Big Mac Burger\t\tRM 7.50 "<<endl;
cout<<" (2) Fillet-O Fish Burger\tRM 6.75 "<<endl<<endl;
cout<<"====SIDE DISH=========================================================="<<endl;
cout<<" (3) Apple Pie\t\t\tRM 2.55 " <<endl;
cout<<" (4) French Fries\t\tRM 2.55 " <<endl<<endl;
{
cout << "Please choose your order on the menu(1-6):" << endl;
cin >> order;
system("cls"); //clearing system
while ((order <= 0) || (order>6)) //while loop the statement if customer choose the number not in menu list
{
cout << "We only have 1 to 6 order , please choose your meal again" << endl;
cin >> order;
}
}
system("cls"); //clearing system
switch(order) //case of option
{break;
case 1:
cout<<"How many Big Mac Burger would you like to order:\n";
cin>>num1;
break;
case 2:
cout<<"How many Fillet-O Fish Burger would you like to order:\n";
cin>>num2;
break;
case 3:
cout<<"How many Apple Pie would you like to order:\n";
cin>>num3;
break;
case 4:
cout<<"How many French Fries would you like to order:\n";
cin>>num4;
break;
case 5:
cout<<"How many Coke would you like to order:\n";
cin>>num5;
break;
case 6:
cout<<"How many Sprite would you like to order:\n";
cin>>num6;
break;
cout<<endl;
}
//calculation of if the customer wan to add order
qnum1 = qnum1 + num1;
qnum2 = qnum2 + num2;
qnum3 = qnum3 + num3;
qnum4 = qnum4 + num4;
qnum5 = qnum5 + num5;
qnum6 = qnum6 + num6;
//calculation of total price of each item
sale1 = UnitPrice1 * qnum1;
sale2 = UnitPrice2 * qnum2;
sale3 = UnitPrice3 * qnum3;
sale4 = UnitPrice4 * qnum4;
sale5 = UnitPrice4 * qnum5;
sale6 = UnitPrice6 * qnum6;
//total all the price
total = sale1 + sale2 + sale3 + sale4 + sale5 +sale6;
cout<<"Do you still have any topping? ( y / n )"<<endl;
cin>>ans1;
}
while(ans1=='y'); //will loop back the menu if customer want to add order
system("cls"); //clearing system
{
cout<<"Receipt:"<<endl<<endl; //display the receipt
cout<<"\tITEM\t"<<"\t\tQUANTITY\t"<<"UNIT PRICE\t"<<"Total of sale\t"<<endl;
cout<<" Big Mac Burger"<<"\t\t\t"<<qnum1<<"\t\t"<<UnitPrice1<<"\t\t"<<sale1<<endl<<endl;
cout<<" Fillet-O Fish Burger:"<<"\t\t"<<qnum2<<"\t\t"<<UnitPrice2<<"\t\t"<<sale2<<endl<<endl;
cout<<" Apple Pie:"<<"\t\t\t"<<qnum3<<"\t\t"<<UnitPrice3<<"\t\t"<<sale3<<endl<<endl;
cout<<" French Fries:"<<"\t\t\t"<<qnum4<<"\t\t"<<UnitPrice4<<"\t\t"<<sale4<<endl<<endl;