Question: C++ code. Please comment on each line. Define a struct, MenuItem, with two components: name of type string and price of type double. Write a

C++ code. Please comment on each line.

Define a struct, MenuItem, with two components: name of type string and price of type double.

Write a program to help a local restaurant automate its breakfast billing system. The program should do the following:

Show the customer the different breakfast items offered by the restaurant.

Allow the customer to select more than one item from the menu.

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):

Name Price
Plain Egg $2.45
Muffin $0.99
Bacon and Egg $2.99
French Toast $3.99
Fruit Basket $4.49
Cereal $0.69
Coffee $1.59
Tea $1.75

Use an array, menuList, of the struct MenuItem. Your program must contain at least the following functions:

Function getData: This function loads the data into the array menuList from a text file. You will need to create a text file containing the menu information. Format your text file so that it works well for your program.

Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items.

Function makeSelection: This function repeatedly asks the customer if they would like to make a selection until the enter an N or n. If the customer enters Y or y, the program gets a menu item by number and a quantity from the customer. This function should not store anything within this menuList array. Instead, store the quantities of each time purchased in a parallel array.

Function printCheck: This function calculates and prints the check. (Note that the billing amount should include a 5% tax.)

Sample Output (user input is in yellow)

Welcome to Johnny's Restaurant --------Today's Menu-------- 1: Plain Egg $2.45 2: Muffin $0.99 3: Bacon and Egg $2.99 4: French Toast $3.99 5: Fruit Basket $4.49 6: Cereal $0.69 7: Coffee $1.59 8: Tea $1.75 Do you want place an order? (y/n): y Enter item number: 3 Enter item quantity: 4 Select another item? (y/n): y Enter item number: 7 Enter item quantity: 10 Select another item? (y/n): y Enter item number: 2 Enter item quantity: 1 Select another item? (y/n): n Thank you for eating at Johnny's Restaurant 1 Muffin $ 0.99 4 Bacon and Egg $11.96 10 Coffee $15.90 Tax $ 1.44 Amount Due $30.29 

Format your output with two decimal places. The name of each item in the output must be left justified. Right-justify the price and quantities.

Submit your cpp file and the text file containing the menu information.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!