C++ Instructions
Redo Exercise 4 so that the customer can select multiple items of a particular type. A sample output in this case is:
Welcome to Johnny's Resturant ----Today's Menu---- 1: Plain Egg $1.45 2: Bacon and Egg $2.45 3: Muffin $0.99 4: French Toast $1.99 5: Fruit Basket $2.49 6: Cereal $0.69 7: Coffee $0.50 8: Tea $0.75 You can make up to 8 different selections Do you want to make selection Y/y (Yes), N/n (No): Y Enter item number: 1 How many orders: 3 Select another item Y/y (Yes), N/n (No): Y Enter item number: 8 How many orders: 1 Select another item Y/y (Yes), N/n (No): N Welcome to Johnny's Resturant 3 Plain Egg $4.35 1 Tea $0.75 Tax $0.26 Amount Due $5.35
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change.
If you are satisfied with the solution, please rate the answer.
Thank You !
===========================================================================
# include <iostream>
# include <iomanip>
# include <string>
using namespace std;
void displayMenu(){
cout<<"Welcome to Johnny\'s Resturant\n";
cout<<"---- Today\'s Menu ----\n";
cout<<"1. Plain Egg $1.45\n";
cout<<"2. Bacon and Egg $2.45\n";
cout<<"3. Muffin $0.99\n";
cout<<"4. French Toast $1.99\n";
cout<<"5. Fruit Basket $2.49\n";
cout<<"6. Cereal $0.69\n";
cout<<"7. Coffee $0.50\n";
cout<<"8. Tea $0.75\n";
cout<<"You can make up to 8 different
selections\n";
}
char getChoice(string message){
char choice;
do{
cout<<message;
cin>>choice;
}while (!(choice=='y' || choice=='Y' || choice=='n' ||
choice =='N'));
if(choice=='y')return 'Y';
else if(choice=='n') return 'N';
else return choice;
}
int getItemNumber(){
int itemNumber;
do{
cout<<"Enter item number: ";
cin>>itemNumber;
}while(1>itemNumber || itemNumber>8);
return itemNumber;
}
int getOrderCount(){
int orders;
do{
cout<<"How many orders: ";
cin>>orders;
}while(1>orders );
return orders;
}
int main(){
double itemPrice[8]
={1.45,2.45,0.99,1.99,2.49,0.69,0.50,0.75};
string itemNames[] ={"Plain Egg","Bacon and
Egg","Muffin","French Toast",
"Fruit Basket", "Cereal", "Coffee", "Tea"
};
int orders[8]={0};
const double TAX_RATE_ = 0.051;
char choice;
int itemNumber=0, order=0;
displayMenu();
string message = "Do you want to make selection Y/y
(Yes), N/n (No): ";
do{
choice = getChoice(message);
if(choice=='Y'){
message =
"Select another item Y/y (Yes), N/n (No): ";
itemNumber =
getItemNumber();
order =
getOrderCount();
orders[itemNumber-1]+=order;
}
}while(choice!='N');
double totalAmount = 0.0;
cout<<"Welcome to Johnny's Resturant \n";
for(int index=0 ; index < 8; index ++){
totalAmount +=
orders[index]*itemPrice[index];
if(orders[index]>0) {
cout<<orders[index]<<"
"<<setw(15)<<left<<itemNames[index]<<"
"<<"$"<<setprecision(2)<<setw(10)<<fixed
<<orders[index]*itemPrice[index]<<endl;
}
}
cout<<setw(18)<<left<<"
Tax"<<"$"<<setprecision(2)<<setw(10)<<fixed<<TAX_RATE_*totalAmount<<endl;
cout<<setw(18)<<left<<" Amount
Due"<<"$"<<setprecision(2)<<setw(10)<<fixed<<(TAX_RATE_+1)*totalAmount<<endl;
}
======================================================================

C++ Instructions Redo Exercise 4 so that the customer can select multiple items of a particular...
Assume that a restaurant offers the following breakfast items: Plain Egg $1.45 Bacon and Egg $2.45 Muffin $0.99 French Toast $1.99 Fruit Basket $2.49 Cereal $0.69 Coffee $0.50 Tea $0.75 Write a program that stores the following data about each menu item in a structure called MenuItem: • A description of the menu item • The price of the menu item • A count of the number of times the item has been ordered The program should keep an array...
c++
Write a C++ program using the struct keyword to help a local restaurant automate its breakfast billing system The program should do the following: a. Show the customer the different breakfast items offered by the restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item) Menu Plain...
#include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; getData(menuList); showMenu(menuList, menuItems); while(ordering) { cout << "Enter the number for the item you would\n" << "like to order, or...
For my assignment I have to write a program that creates a restaurant billing system. I think that I got it correct but it says that it is incorrect, so I was wondering if someone would be able to look over my code. It says that I need tax of $0.20, and the amount due to be $4.10, which is what I have in my output.https://imgur.com/a/jgglmvWMy issue is that I have the correct outcome when I run my program but...
In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...