Trying Solve Problem Answered Followed Instructions Unable Compile Code Include Include In Q29964265

Write a program 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) Plain Egg Bacon and Egg Muffin French Toast Fruit Basket Cereal Coffee Tea $1.45 $2.45 $0.99 $1.99 $2.49 $0.69 $0.50 $0.75 Use an array, menuList, of the struct menuItemType, as defined i Programming Exercise 3. Your program must contain at least th following functions: Function getData: This function loads the data into the array menuList Function showMenu: This function shows the different item offered by the restaurant and tells the user how to select the items, Function printCheck: This function calculates and prints the check (Note that the billing amount should include a 5% tax.) A sample output is: ielcome to Johnnys Restaurant Bacon and Egg $2.45 Muffin Coffee Tax Amount Due $0.99 $0.50 $0.20 $4.14 Format your output with two decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one item of a particular type.

I am trying to solve this problem that has been answered. Ifollowed the instructions and I am unable to compile. My code:

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;   

struct menuItemType;

{

double menuitem[10];

double menuprice[10];

}

void getData(menuItemType &m,int &c);

void showMenu();

void printcheck (menuItemType &m, int c);

void main()

{

menuItemType menulist;

int c;

showMenu();

getData(menulist,c);

printcheck(menulist,c);

system(“pause”);

}

void showMenu()

{

cout<<“Welcome to Johnny’s Restaurant”<<endl;

cout<<“1.PlainEgg”<<“tt”<<“$1.45″<<endl;

cout<<“2.Bacon &Egg”<<“tt”<<“$2.45″<<endl;

cout<<“3.Muffin”<<“tt”<<“$0.99″<<endl;

cout<<“4.FrenchToast”<<“tt”<<“$1.99″<<endl;

cout<<“5.FruitBasket”<<“tt”<<“$2.49″<<endl;

cout<<“6.Cereal”<<“tt”<<“$0.69″<<endl;

cout<<“7.Coffee”<<“tt”<<“$0.50″<<endl;

cout<<“8.Tea”<<“tt”<<“$0.75″<<endl;

}

void getData(menuItemType &m,int &c)

{

int k;

int choice;

cout<<“Enter total # of items customerneeds”<<endl;

cin>>c;

cout<<“Enter item numbers”<<endl;

for (k=0;k<c;k++)

{

cin>>choice;

switch(choice)

{

case 1:m.menuitem[k]=”Plain Egg”;

m.menuprice[k]= 1.45;

break;

case 2:m.menuitem[k]=”Bacon & Egg”;

m.menuprice[k]= 2.45;

break;

case 3:m.menuitem[k]=”Muffin”;

m.menuprice[k]= 0.99;

break;

case 4:m.menuitem[k]=”French Toast”;

m.menuprice[k]= 1.99;

break;

case 5:m.menuitem[k]=”Fruit Basket”;

m.menuprice[k]= 2.49;

break;

case 6:m.menuitem[k]=”Cereal”;

m.menuprice[k]= 0.69;

break;

case 7:m.menuitem[k]=”Coffee”;

m.menuprice[k]= 0.50;

break;

case 8:m.menuitem[k]=”Tea”;

m.menuprice[k]= 0.75;

break;

}

}

}

void printcheck(menuItemType &m,int c);

{

int j;

float price=0.0, tax=0.0,total;

cout<<“Johnny’s”<<endl;

for(j=0;j<c;j++)

{

cout<<m.menuitem[j]<<“tt”<<m.menuprice[j]<<endl;

price=price+m.menuprice[j];

}

tax=0.05*price;

total=tax+price;

std::cout<<std::fixed;

std::cout<<std::setprecision(2);

cout<<“Tax=”<<“tt”<<tax<<endl;

cout<<“Amountdue=”<<“t”<<total<<endl;

}

Please provide a working code as well as explanation as to theerrors.

Write a program 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) Plain Egg Bacon and Egg Muffin French Toast Fruit Basket Cereal Coffee Tea $1.45 $2.45 $0.99 $1.99 $2.49 $0.69 $0.50 $0.75 Use an array, menuList, of the struct menuItemType, as defined i Programming Exercise 3. Your program must contain at least th following functions: Function getData: This function loads the data into the array menuList Function showMenu: This function shows the different item offered by the restaurant and tells the user how to select the items, Function printCheck: This function calculates and prints the check (Note that the billing amount should include a 5% tax.) A sample output is: ielcome to Johnny’s Restaurant Bacon and Egg $2.45 Muffin Coffee Tax Amount Due $0.99 $0.50 $0.20 $4.14 Format your output with two decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one item of a particular type. Show transcribed image text

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.