Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that a restaurant offers the following breakfast items: Plain Egg $1.45 Bacon and Egg $2.45 Muffin $0.99 French Toast $1.99 Fruit Basket $2.49 Cereal

Assume that a restaurant offers the following breakfast items:

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

Write a program that stores the following data about each menu item in a structure called MenuItem: A description of the menu item The price of the menu item

A count of the number of times the item has been ordered The program should keep an array of these structures, one per menu item. When the

program runs, it should initialize the array using the data above, and 0 for the count.

The program should do the following:

  • Show the user the different breakfast items offered by the restaurant.

  • Allow the user to select multiple items from the menu (by number).

  • Calculate and print the bill (including sub-total, tax, and total)

    Note: the tax rate is 7%.

    Then it should ask the user to enter N to add a new order (repeat the steps above for a new order), and E to exit. Once the user selects E, the program should output the total amount of money taken in (the sum of all the orders) and then output the description and count of the item that was ordered the most frequently.

Your program must include three functions:

one to display the menu (descriptions and prices only), one to take the order (it should return the sub-total for the order), and one to determine (and return) the index of the item with the highest count (if more

than one item has the maximum count, it must return the index of any one of them).

These functions should take an array of MenuItem (and perhaps other values) as arguments.

C++ Programming Language

Example of how output should look below

[1] Plain Egg $ 1.45 [2] Bacon and Egg $ 2.45 [3] Muffin $ 0.99 [4] French Toast $ 1.99 [5] Fruit Basket $ 2.49 [6] Cereal $ 0.69 [7] Coffee $ 0.50 [8] Tea $ 0.75 Input the item numbers for the order, 0 to quit 2 2 7 8 0 Subtotal...$ 6.15 Tax........$ 0.43 Total......$ 6.58 Please enter 'N' to take a new order and 'E' to exit: N [1] Plain Egg $ 1.45 [2] Bacon and Egg $ 2.45 [3] Muffin $ 0.99 [4] French Toast $ 1.99 [5] Fruit Basket $ 2.49 [6] Cereal $ 0.69 [7] Coffee $ 0.50 [8] Tea $ 0.75 Input the item numbers for the order, 0 to quit 1 3 6 7 7 0 Subtotal...$ 4.13 Tax........$ 0.29 Total......$ 4.42 Please enter 'N' to take a new order and 'E' to exit: N [1] Plain Egg $ 1.45 [2] Bacon and Egg $ 2.45 [3] Muffin $ 0.99 [4] French Toast $ 1.99 [5] Fruit Basket $ 2.49 [6] Cereal $ 0.69 [7] Coffee $ 0.50 [8] Tea $ 0.75 Input the item numbers for the order, 0 to quit 1 2 3 4 5 6 7 8 0 Subtotal...$ 11.31 Tax........$ 0.79 Total......$ 12.10 Please enter 'N' to take a new order and 'E' to exit: E End of Day: Total money taken in: $23.10 Item ordered most often: Coffee was ordered 4 times. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions