Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language : C++ Sample configuration file (config.txt) (Tables and Menu are in configuration file) Tables: table #, max seats 1 2 2 4 3 2

Language : C++ 

image text in transcribedSample configuration file (config.txt) (Tables and Menu are in configuration file)

Tables: table #, max seats

1 2

2 4

3 2

4 2

5 2

6 4

7 6

8 10

9 2

10 4

11 4

12 4

13 4

14 2

15 2

16 2

17 2

18 2

Menu: listing of the full menu: item code, name, price

A1 Bruschetta 5.29

A2 Caprese_Flatbread 6.10

A3 Artichoke-Spinach_Dip 3.99

A4 Lasagna_Fritta 4.99

A5 Mozzarella_Fonduta 5.99

E1 Lasagna_Classico 6.99

E2 Capellini_Pomodoro 7.99

E3 Eggplant_Parmigiana 8.99

E4 Fettuccine_Alfredo 7.49

E5 Tour_of_Italy 14.99

D1 Tiramisu 2.99

D2 Zeppoli 2.49

D3 Dolcini 3.49

S1 Soda 1.99

S2 Bella_Limonata 0.99

S3 Berry_Acqua_Fresca 2.88

Sample activity file (activity.txt):

1 P2 // Party of 2 is assigned to Table 1

2 P4

4 P2

1 O A1 A1 E1 E2 // Party at table 1 orders these items

8 P10

1 S // Food arrives at table 1

3 P2

1 C // T1 gets the check, pays and leaves & table is cleaned too.

5 P2

1 P1 // Party of 1 is assigned to table 1

In addition to processing these commands, when a table is closed, display the check as well. Include table #, # of customers in the party, name and price of each ordered item and the total. No need to worry about tax or tips.

Error checking:

- Do not allow orders from table with no party assigned to it.

- Do not allow assigning new party to a table when another party is already there.

- Do not allow check-out from empty table or a table in which food has not been served.

- Do not allow delivery of food to an empty table!

- Do not assign a party to a table with insufficient # of chairs.

- Reject any request that does not match with sample formats.

* Load config.txt and setup an array of Table objects and the array of MenuItem objects.

*Complete the remaining functionality (reading the commands from activity.txt & processing them).

Tip: (please try to follow this)

//enum STATUS = {FREE, SEATED, ORDERED, SERVED}; class Table int number; int maxCapacity; int status; //0 - FREE, 1 - SEATED, 2 - ORDERED, 3 - SERVED Order *order; seat(int count) // check whether table is empty? // check count  
 MenuItem items[MAX2]; int numItems; addItem(MenuItem item); // main() can invoke this // again & again to setup menu // "A1" --> ? MenuItem *findItem(string code); //return &items[i]; if item is found //return NULL if not found int getMaxItems(); class Order int tableNumber; /ot needed? MenuItem *itemsp[MAX3]; int numItems; enhance class Table int number; int maxCapacity; Order *order; //points to valid Order object // or NULL 
main(): Table tables[MAX1]; int numTables = 0; MenuItem menu[MAX2]; int numItems = 0; read config.txt and load up the arrays! 

Order *order = new Order(...); ...

Ideas: use getline() to read whole line use istringstream to extract stuff from each line check for empty string to identify end of current data set 
This assignment mimics the configuration and activities happen at a typical restaurant. Input is provided in 2 files: config.txt and activity txt. Configuration file contains how many tables, table waiter relationship & full menu list. Activity file mimics the actual activities that happen in restaurant. After setting up the necessary objects using the configuration file, you can read the activity file and process them. Do not use vector or any other template in this assignment. We will use the following classes to complete this assignment. Feel free to add more variables if needed. Avoid making drastic changes to existing variables. You need to define the classes and implement all the .cpp files including class implementation and overall application functionality. Table status, of max seats, of guests if a party is seated, order if the party has ordered Menu Item: itemCode, name, price Menu array of MenuItems Order a list of menu items ordered at a table

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

Students also viewed these Databases questions

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago