Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Write a program that allows the restaurant owner input the number of differe

ID: 3838381 • Letter: C

Question

C++

Write a program that 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 amounts of each ingrediant. 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.

There should be 4 entrees

1. Burrito

2. Taco

3. Enchillada

4. Quasadilla

Each entree should have the option for these ingrediants, it should allow the user to enter the amount of the ingrediants, and should be saved in a text file so that it does not need to be reentered unless the user chooses to edit the amount of ingrediants.

1. Beef

2. Pork

3. Chicken

4. Bean

5. Rice

6. Corn Tortillas

7. Cheese

8. Enchiladas sauce

9. Salsa

10. Sour Cream

11. Lettuce

12. Tomato

Last the user should be asked how many of each entree they will need for the following week. The program should then calculate the total amount of each ingrediant so that the owner can make an order without doing the math.

Explanation / Answer

//==============Before main routine===================

struct Item {
string ItemID; //the menu item ID
string Name; //the menu item name
int Max; //the maximum number of orders available for item
float Price; //the menu item price
int Available;
};

struct Table {
int tablenum;
int Bill;
int orders;
string Orders[];
};
  
struct OrderList {
int FromTable;
string IDOrdered;
OrderList *next;
};

//=================inside main routine=====================
//array of structs with menu item info...
Item *ItemNumber = new Item[n] //user has entered number 'n'
// representing how many items there are to order
case Order:
int t;//table number
int i;//item nuumber
//what table is ordering...
  
bool valid;
bool check;
do{
valid=false;
cout << endl;
cout<< "what table number is placing an order?" << endl;
cin >> t;
  
// then check if table number is valid...
if ((t<=T) && (t>0)){
valid=true;
}else{
cout<<"***table "<<t<<", is not recognized***";
cout<<endl;
}
}while(valid==false);
  
//what item is being ordered...
valid = false;
do{
cout << endl;
cout << "what is the item's ID that table " << t;
cout << " wishes to order?" << endl;
cin >> ID;
// then check if item ID is valid...
check = false;
do{

i = 0;
if(ID == ItemNumber[i].ItemID){
if(ItemNumber[i].Available>0){
cout<<endl<<endl;
cout<<ItemNumber[i].Name;
cout<<", is available for order!"<<endl;
cout<<endl;
valid=true;
check=true;
ItemNumber[i].Available=ItemNumber[i].Available-1;
}else{
cout<<"*** There are no more orders available for ";
cout<<ItemNumber[i].Name<<" ***";
break;
}
  
}else{
i++;
}
}while((check==false)||(i<n));
if(valid == false){
cout<<"***item ID "<<ID<<", is either not recognized";
cout<<" or out of order***";
cout<<endl;
}
}while(valid == false);
//add data to table struct.
TableNumber[t].tablenum = t;
TableNumber[t].orders ++;
TableNumber[t].Bill=TableNumber[t].Bill+ItemNumber[i].Price;
TableNumber[t].Orders[TableNumber[t].orders]=ItemNumber[i].Name;
break;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote