Write a program to help a local resturant automate its breakfast billing system
ID: 3623086 • Letter: W
Question
Write a program to help a local resturant automate its breakfast billing system . Write a program to help a local resturant automate its breakfast billing system. the program should do the following : the program should do the following:a. a. Show the customer the different breakfast items offered by the resturant. Show the customer the different breakfast items offered by the resturant.
b. b. Allow the costimer to select more than one item from the menu . Allow the costimer to select more than one item from the menu.
c. c. Calculate and print the bill . Calculate and print the bill.
Assume that the resturant offers the following breakfast items ( the price of each item is shown to the right of the item): Assume that the resturant offers the following breakfast items (the price of each item is shown to the right of the item):
plain Egg 1.45 plain Egg 1.45
Bacon and Egg 2.45 Bacon and Egg 2.45
muffin 0.99 muffin 0.99
French Toast 1.99 French Toast 1.99
Fruit basket 2.49 Fruit basket 2.49
Cereal 0.69 Cereal 0.69
Coffee 0.50 Coffee 0.50
Tea 0.75 Tea 0.75
use an array , menuList, of the struct menuItemType. use an array, menuList, of the struct menuItemType.
your program must contain at least the following functipons : your program must contain at least the following functipons:
* function getData: this function loads the data into the array menuList. * Function getData: this function loads the data into the array menuList.
* function showMenu : this function shows the different items offered by the restaurant and tells the user how to sellect the items. * Function showMenu: this function shows the different items offered by the restaurant and tells the user how to sellect the items.
* function printCheck : this function calculates and prints the check. * Function printCheck: this function calculates and prints the check.
(note that the billing amount should include the 5% tax) (Note that the billing amount should include the 5% tax)
format your output with two decimle places. format your output with two decimle places. the name of each item in the output must be left-justified. the name of each item in the output must be left-justified. you may assume that the user sellect inly one item of a particular type. you may assume that the user sellect inly one item of a particular type.
Explanation / Answer
please rate - thanks
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
struct menuItemType
{string menuItem;
double menuPrice;
};
void getdata( menuItemType[],menuItemType[],int&);
void showMenu( menuItemType[],int);
void printCheck(menuItemType[],int );
int main()
{
int items=0;
menuItemType menuList[]={"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
};
menuItemType order[10];
cout<<"Welcome to my Restaurant My menu Item price ";
showMenu(menuList,8);
getdata(menuList,order,items);
printCheck(order,items);
system("pause");
return 0;
}
void printCheck(menuItemType order[],int items)
{int i;
double total=0,tax;
cout<<"Your Check Ordered Items Item price ";
showMenu(order,items);
for(i=0;i<items;i++)
total+=order[i].menuPrice;
cout<<" Item total "<<"$"<<setprecision(2)<<fixed<<total<<endl;
tax=total*.05;
cout<<"Tax "<<"$"<<setprecision(2)<<fixed<<tax<<endl;
cout<<"Amount Due "<<"$"<<setprecision(2)<<fixed<<total+tax<<endl;
}
void getdata(menuItemType menu[],menuItemType order[],int& items)
{char yesno='Y';
int n;
while(toupper(yesno)=='Y')
{cout<<"Enter your order item number: ";
cin>>n;
while(n<1||n>8)
{cout<<"invalid item number ";
cout<<"Enter your order item number: ";
cin>>n;
}
order[items].menuItem=menu[n-1].menuItem;
order[items].menuPrice=menu[n-1].menuPrice;
items++;
cout<<"Would you like another item?(y/n)? ";
cin>>yesno;
}
}
void showMenu(menuItemType a[],int n)
{int i;
for(i=0;i<n;i++)
cout<<i+1<<". "<<setw(16)<<left<<a[i].menuItem<<"$"<<setprecision(2)<<fixed<<a[i].menuPrice<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.