Question: I need code to be completed according to this prompt: 1 . Activities in a typical restaurant This assignment mimics the configuration and activities happen

I need code to be completed according to this prompt:
1. Activities in a typical restaurant
This assignment mimics the configuration and activities happen at a typical restaurant. Configuration data is in config.txt. Configuration file contains the table information & the full menu list.
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 .java files including class implementation and the overall application functionality.
Table : status, # of max seats, # of guests if a party is seated, a pointer to order if the party has ordered
MenuItem: itemCode, name, price
Menu : array of MenuItems
Order : a list of menu items ordered at a table
Read the configuration file and create the necessary objects / array of objects, then proceed to read the activities from the user and process them one at a time. Do not use any advanced data structures (STLs like vectors) that have not been covered in the class.
Sample configuration file (config.txt)
16 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
Here is the .code I have:
MenuItem.h
#pragma once
#include
class MenuItem {
public:
MenuItem(std::string code, std::string name, double price);
std::string getItemCode();
std::string getItemName();
double getItemPrice();
private:
std::string itemCode;
std::string itemName;
double itemPrice;
};
MenuItem.cpp:
#include "MenuItem.h"
MenuItem::MenuItem(std::string code, std::string name, double price){
itemCode = code;
itemName = name;
itemPrice = price;
}
std::string MenuItem::getItemCode(){
return itemCode;
}
std::string MenuItem::getItemName(){
return itemName;
}
double MenuItem::getItemPrice(){
return itemPrice;
}
Table.h:
#pragma once
#include
#include "MenuItem.h"
class Table {
public:
Table(int number, int maxSeats);
int getTableNumber();
int getMaxSeats();
bool isOccupied();
void assignParty(int partySize);
bool placeOrder(std::vector& menu);
bool serveFood();
void closeTable();
private:
int tableNumber;
int maxSeats;
bool occupied;
int partySize;
bool foodServed;
std::vector orderedItems;
};
Table.cpp:
#include "Table.h"
Table::Table(int number, int maxSeats){
tableNumber = number;
this->maxSeats = maxSeats;
occupied = false;
foodServed = false;
}
int Table::getTableNumber(){
return tableNumber;
}
int Table::getMaxSeats(){
return maxSeats;
}
bool Table::isOccupied(){
return occupied;
}
void Table::assignParty(int partySize){
if (!occupied && partySize <= maxSeats){
occupied = true;
this->partySize = partySize;
}
}
bool Table::placeOrder(std::vector& menu){
if (occupied){
// Code to take orders and add them to orderedItems
return true;
}
return false;
}
bool Table::serveFood(){
if (occupied && !foodServed && !orderedItems.empty()){
foodServed = true;
return true;
}
return false;
}
void Table::closeTable(){
if (occupied && foodServed){
// Code to calculate the bill and close the table
occupied = false;
foodServed = false;
orderedItems.clear();
}
}
Order.h:
#pragma once
#include
#include "MenuItem.h"
class Order {
public:
void addOrder(MenuItem item);
double calculateTotal(std::vector& menu);
private:
std::vector items;
};
Order.cpp:
#include "Order.h"
void Order::addOrder(MenuItem item){
items.push_back(item);
}
double Order::calculateTotal(std::vector& menu){
double total =0.0;
for (const MenuItem& item : items){
// Code to find the item in the menu and accumulate the total
}
return total;
}
Menu.h:
#ifndef MENU_H
#define MENU_H
#include
#include "MenuItem.h"
class Menu {
private:
std::vector menuItems;
public:
void addItem(const MenuItem& item);
MenuItem* findItemByCode(const std::string& itemCode);
};
#endif // MENU_H
Menu. cpp
#include "Menu.h"
void Menu::addItem(const MenuItem& item){
menuItems.push_back(item);
}
MenuItem* Menu::findItemByCode(const std::string& itemCode){
// Implement the search logic here and return the MenuItem pointer
}
main. cpp
#include
#include
#include
#include "Table.h"
#include "Menu.h"
#include "Order.h"
int main(){
// Read configuration file and create objects
// Implement the main program logic here
return 0;
}

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 Programming Questions!