C++ Write a program allows the restaurant owner input the number of different en
ID: 3836597 • Letter: C
Question
C++
Write a program allows the restaurant owner input the number of different entrees they wish to prepare for the week. The program will tell the owner exactly how much of each ingredient they will need to order. By using this program, they will be able to eliminate waste and order quickly and efficiently. The owner will have the option to edit the menu entrees and the ingredients. Each menu entree will be represented by a struct containing the amount of each ingredient required to make it. Choose a list of entrees and ingredients.
· The program must be written in a modularized / object oriented manner.
· You MUST make effective use of data structures ( don't use a dynamic array or a vector when a simple static array will do the job).
Here is an example of the output should look like:
Menu:
1. Edit Menu Items
2. Place an order
3. Exit
Please enter your menu number: 1
Edit Menu Items:
1. Enter New Menu Item
2. Edit Old Menu Item
Please enter your menu number: 1
Please enter the name of the entrée:
Chicken Enchiladas
Please enter the amount in “cups” of the following ingredients:
Beef: 0
Pork: 0
Chicken: ½
Bean: ½
Rice: ½
Corn Tortillas: 0
Cheese: ½
Enchiladas sauce: ½
Salsa: 0
Sour Cream: 1/8
Lettuce: 0
Tomato: 0
Menu:
1. Edit Menu Items
2. Place an order
3. Exit
Please enter your menu number: 1
Edit Menu Items:
1. Enter New Menu Item
2. Edit Old Menu Item
Please enter your menu number: 1
Please enter the name of the entrée:
Bean, Cheese and Rice Burritos
Please enter the amount in “cups” of the following ingrediants:
Beef: 0
Pork: 0
Chicken: 0
Bean: ½
Rice: ½
Corn Tortillas: 0
Cheese: ½
Enchiladas sauce: 0
Salsa: 0
Sour Cream: 0
Lettuce: 0
Tomato: 0
Menu:
1. Edit Menu Items
2. Place an order
3. Exit
Please enter your menu number: 1
Edit Menu Items:
1. Enter New Menu Item
2. Edit Old Menu Item
Please enter your menu number: 1
Please enter the name of the entrée:
Pork Tacos
Please enter the amount in “cups” of the following ingredients:
Beef: 0
Pork: ½
Chicken: 0
Bean: ½
Rice: ½
Corn Tortillas: 0
Cheese: ½
Enchiladas sauce: 0
Salsa: 0
Sour Cream: 0
Lettuce: 1/8
Tomato: 1/8
Menu:
1. Edit Menu Items
2. Place an order
3. Exit
Please enter your menu number: 1
Edit Menu Items:
1. Enter New Menu Item
2. Edit Old Menu Item
Please enter your menu number: 2
Edit Old Menu Item:
Which item would you like to change:
Chicken Enchiladas
Bean, Cheese, and Rice Burritos
Pork Tacos
Please enter the name of the entrée:
Pork Tacos
Please enter the amount in “cups” of the following ingrediants:
Beef: 0
Pork: 1
Chicken: 0
Bean: ½
Rice: ½
Corn Tortillas: 0
Cheese: ½
Enchiladas sauce: 0
Salsa: 0
Sour Cream: 0
Lettuce: 1/8
Tomato: 1/8
Menu:
1. Edit Menu Items
2. Place an inventory order
3. Exit
Please enter your menu number: 2
Enter the number of each Menu item you will need
Chicken Enchiladas: 5
Bean, Cheese, and Rice Burritos: 4
Pork Tacos: 3
You will need to order these ingredients (in cups):
Beef: 0
Pork: 3/2
Chicken:5/2
Bean: 6
Rice: 6
Corn Tortillas: 0
Cheese: 6
Enchiladas sauce: 5/2
Salsa: 0
Sour Cream: 5/8
Lettuce: 3/8
Tomato: 3/8
Menu:
1. Edit Menu Items
2. Place an inventory order
3. Exit
Please enter your menu number: 3
Explanation / Answer
#include"iostream.h"
#include"string"
int main()
{
int ch1,ch2;
std::string str;
struct Item //creating ingreidients
{
double bf;
double p;
double ch;
double be;
double r;
double ct;
double che;
double ens;
double sa;
double sou;
double le;
double to;
}i[3];
while(1) //Menu
{
cout<<"Menu"<<endl;
cout<<"1. Edit Menu Items"<<endl;
cout<<"2. Place an order"<<endl;
cout<<"3. Exit"<<endl;
cout<<"Please enter your menu number:";
cin>>ch1;
if(ch1==1)
{
cout<<"Edit Menu Items"<<endl; //Menu Items
cout<<"1. Enter New Menu Item"<<endl;
cout<<"2. Enter Old Menu Item"<<endl;
cout<<"Please enter your menu number:";
cin>>ch2;
if(ch2==1)
{
cout<<"Please enter the name of the entree"<<endl;
cin>>str;
cout<<"Please enter the amount in "cups" of the following ingredients"; //Taking Input
if(str.compare("Chicken Enchiladas")==0)
{
cin>>i[0].bf>>i[0].p>>i[0].ch>>i[0].be>>i[0].r>>i[0].ct>>i[0].che>>i[0].ens>>i[0].sa>>i[0].sou>>i[0].le>>i[0].to;
}
else if(str.compare("Bean, Cheese and Rice Burritos")==0)
{
cin>>i[1].bf>>i[1].p>>i[1].ch>>i[1].be>>i[1].r>>i[1].ct>>i[1].che>>i[1].ens>>i[1].sa>>i[1].sou>>i[1].le>>i[1].to;
}
else if(str.compare("Pork Tacos")==0)
{
cin>>i[2].bf>>i[2].p>>i[2].ch>>i[2].be>>i[2].r>>i[2].ct>>i[2].che>>i[2].ens>>i[2].sa>>i[2].sou>>i[2].le>>i[2].to;
}
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.