can you modify my answer, so that i can get a 6% discount if 'AE6GY' promo code is entered #include using namespace std; void menu() { cout << "******Welcome to the Farhan's Restaurant******" << endl; cout<<"_________________________________________________"<>phone; float jum; string promo; int n; int qty[7]; int no[7]; long price[7],tot[4]; string name[7]; float change,pay,discount; menu(); cout<<""<>n; if(n>0 && n<=7) //loop for menus { for(int i=0; i>pay; //cout<<"Do you have a promo code?"<>promo; while() { cout<<"Do you have a promo code?"<>promo; if (promo == "AE6GY") { isDiscountApplied = true; break; } } // change=pay-jum; cout<<"________________________________"<
- can you modify my answer, so that i can get a 6% discount if 'AE6GY' promo code is entered
#include <iostream>
using namespace std;
void menu()
{
cout << "******Welcome to the Farhan's Restaurant******" << endl;
cout<<"_________________________________________________"<<endl;
cout<<"No. Menu Price"<<endl;
cout<<"1. Cheese Burger RM 8"<<endl;
cout<<"2. Chicken Wings(6 pieces) RM 10"<<endl;
cout<<"3. 12\" Pepperoni Pizza RM 20"<<endl;
cout<<"4. Fries RM 5"<<endl;
cout<<"5. Onion Rings RM 6"<<endl;
cout<<"6. Pepsi RM 2"<<endl;
cout<<"7. Mineral Water RM 3"<<endl;
}
main()
{
string phone; //we use string so that the 0 value can be displayed
string Name;
cout<<"Please enter your name :";
getline(cin,Name); //to ensure we can input two names at once
cout<<"Please enter your phone number :";
cin>>phone;
float jum;
string promo;
int n;
int qty[7];
int no[7];
long price[7],tot[4];
string name[7];
float change,pay,discount;
menu();
cout<<""<<endl;
cout<<"How many types of menu do you want: ";
cin>>n;
if(n>0 && n<=7) //loop for menus
{
for(int i=0; i<n;i++)
{
cout<<"Enter your choice "<<i+1<<"=";
cin>>no[i];
cout<<"Enter quantity =";
cin>>qty[i];
if(no[i]==1)
{
name[i]="Cheese Burger";
price[i]=8;
tot[i]=price[i]*qty[i];
}
else if(no[i]==2)
{
name[i]="Chicken Wings(6 pieces)";
price[i]=10;
tot[i]=price[i]*qty[i];
}
else if(no[i]==3)
{
name[i]="12\" Pepperoni Pizza ";
price[i]=20;
tot[i]=price[i]*qty[i];
}
else if(no[i]==4)
{
name[i]="Fries";
price[i]=5;
tot[i]=price[i]*qty[i];
}
else if(no[i]==5)
{
name[i]="Onion Rings";
price[i]=6;
tot[i]=price[i]*qty[i];
}
else if(no[i]==6)
{
name[i]="Pepsi";
price[i]=2;
tot[i]=price[i]*qty[i];
}
else if(no[i]==7)
{
name[i]="Mineral Water";
price[i]=3;
tot[i]=price[i]*qty[i];
}
jum=jum+tot[i];
}
system("cls");
menu();
cout<<"_________________________________"<<endl;
cout<<"Your choice is :"<<endl;
for(int i=0;i<n;i++) //loop for order quantity
{
cout<<""<<qty[i]<<" portion "<<""<<name[i]<<endl;
cout<<"Price/portion ="<<price[i]<<endl;
cout<<"Total Price "<<name[i]<<"="<<tot[i]<<endl;
}
cout<<"We only accept cash payments"<<endl;//I state that my shop only receive cash payments
cout<<"paid : Rm ";
cin>>pay;
//cout<<"Do you have a promo code?"<<endl;
// cin>>promo;
while()
{
cout<<"Do you have a promo code?"<<endl;
cin>>promo;
if (promo == "AE6GY")
{
isDiscountApplied = true;
break;
}
}
// change=pay-jum;
cout<<"________________________________"<<endl;
cout<<"Your name is:"<<Name<<endl;
cout<<"Phone no is:"<<phone<<endl;
cout<<"Change: Rm"<<change<<endl;
cout<<"Thank you for visiting";
}
else
cout<<"Code your input doesnt exist";
return 0;
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)