Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++: I've tried everything but I can't seem to figure out this problem. Thank you in advance. Write a program to help a local restaurant

C++: I've tried everything but I can't seem to figure out this problem. Thank you in advance.

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.
Item Price
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

Use an array, menuList, of the struct menuItemType. 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.)

main.cpp template

#include #include #include #include #include "functions.cpp"

using namespace std;

const int NO_OF_ITEMS = 8;

int main() { menuItemType menuList[NO_OF_ITEMS]; int choiceList[NO_OF_ITEMS]; int choiceListLength;

ifstream inFile;

cout << fixed << showpoint << setprecision(2);

inFile.open("breakfasts.txt");

if (!inFile) { cout << "Cannot open the input file. Program Terminates!" << endl; return 1; }

// call getData // call showMenu // call makeSelection // call printCheck

return 0; } ====================

functions.cpp template

#include #include #include #include

using namespace std;

// struct for menuItemType

// load data from file inline void getData(ifstream& inFile, menuItemType mList[], int listSize) { // function code }

// part a inline void showMenu(menuItemType mList[], int listSize) { // function code }

// part c inline void printCheck(menuItemType mList[], int listSize, int cList[], int cListLength) { // function code }

inline bool isItemSelected(int cList[], int cListLength, int itemNo) { // function code }

// part b inline void makeSelection(menuItemType mList[], int listSize, int cList[], int& cListLength) { // function code }

====================

breakfasts.txt

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

design a simple performance appraisal system

Answered: 1 week ago