Write a program to help a local restaurant automate its breakfast billing system
ID: 3644563 • Letter: W
Question
Write a program to help a local restaurant automate its breakfast billingsystem. 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 $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
Your program must contain at least the
following functions:
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 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:
Welcome to Johnny's Restaurant
Bacon and Egg :$2.45
Muffin: $0.99
Coffee: $0.50
Tax: $0.20
Amount Due: $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.
Explanation / Answer
#include #include #include #include using namespace::std; struct menuItemType { char menuItem[20]; double menuPrice; }; void getData(menuItemType menuList[8]); void showMenu(menuItemType menuList[8], menuItemType orderList[], int orderCounter, int selection); void printCheck(menuItemType menuList[8], int orderCounter, const double TAX); const int MAX = 8; const double TAX = 1.05; menuItemType menuList[8]; menuItemType orderList[MAX]; int main() { int orderCounter = 0; int selection = ' '; getData(menuList); showMenu(menuList, orderList, orderCounter, selection); printCheck(orderList, orderCounter, TAX); return 0; } void getData(menuItemType menuList[8]) { strcpy(menuList[0].menuItem,"Plain Egg"); menuList[0].menuPrice = 1.45; strcpy(menuList[1].menuItem,"Bacon and Egg"); menuList[1].menuPrice = 2.45; strcpy(menuList[2].menuItem,"Muffin"); menuList[2].menuPrice = 0.99; strcpy(menuList[3].menuItem,"French Toast"); menuList[3].menuPrice = 1.99; strcpy(menuList[4].menuItem,"Fruit Basket"); menuList[4].menuPrice = 2.49; strcpy(menuList[5].menuItem,"Cereal"); menuList[5].menuPrice = 0.69; strcpy(menuList[6].menuItem,"Coffee"); menuList[6].menuPrice = 0.50; strcpy(menuList[7].menuItem,"Tea"); menuList[7].menuPrice = 0.75; } void showMenu(menuItemType menuList[8], menuItemType orderList[], int orderCounter, int selection) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.