Language C++ This assignment mimics the configuration and activities happen at a
ID: 3820093 • Letter: L
Question
Language C++
This assignment mimics the configuration and activities happen at a typical restaurant. Input is provided in 2 files: config.txt and activity.txt. The configuration file contains how many tables, full menu list. Activity file mimics the actual activities that happen in a 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
MenuItem: itemCode, name, price
Menu : array of MenuItems
Order : a list of menu items ordered at a table
Sample configuration file (config.txt)
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:
Unlike real restaurant's you do not have to worry about waiters.
Explanation / Answer
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 *findItem(string code); //return &items[i]; if item is found //return NULL if not found int getMaxItems(); class Order int tableNumber; //not needed? MenuItem *itemsp[MAX3]; int numItems; enhance class Table int number; int maxCapacity; Order *order; //points to valid Order object // or NULL main(): string line; int tableNum, capacity; string code, name; double price; ifstream finput("config.txt"); getline(finput, line); //get first line and ignore it while (finput >> tableNum >> capacity) { tables[... ... } finput.clear(); getline(finput, line); while (finput >> code >> name >> price) { menuItems[...... }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.