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:
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 configtxt
Menu: Listing of the full menu: item code, name, price
A Bruschetta
A CapreseFlatbread
A ArtichokeSpinachDip
A LasagnaFritta
A MozzarellaFonduta
E LasagnaClassico
E CapelliniPomodoro
E EggplantParmigiana
E FettuccineAlfredo
E TourofItaly
Here is the code I have:
MenuItem.h
#pragma once
#include
class MenuItem
public:
MenuItemstd::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::MenuItemstd::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:
Tableint number, int maxSeats;
int getTableNumber;
int getMaxSeats;
bool isOccupied;
void assignPartyint partySize;
bool placeOrderstd::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::Tableint number, int maxSeats
tableNumber number;
thismaxSeats maxSeats;
occupied false;
foodServed false;
int Table::getTableNumber
return tableNumber;
int Table::getMaxSeats
return maxSeats;
bool Table::isOccupied
return occupied;
void Table::assignPartyint partySize
if occupied && partySize maxSeats
occupied true;
thispartySize partySize;
bool Table::placeOrderstd::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 addOrderMenuItem item;
double calculateTotalstd::vector& menu;
private:
std::vector items;
;
Order.cpp:
#include "Order.h
void Order::addOrderMenuItem item
items.pushbackitem;
double Order::calculateTotalstd::vector& menu
double total ;
for const MenuItem& item : items
Code to find the item in the menu and accumulate the total
return total;
Menu.h:
#ifndef MENUH
#define MENUH
#include
#include "MenuItem.h
class Menu
private:
std::vector menuItems;
public:
void addItemconst MenuItem& item;
MenuItem findItemByCodeconst std::string& itemCode;
;
#endif MENUH
Menu. cpp
#include "Menu.h
void Menu::addItemconst MenuItem& item
menuItems.pushbackitem;
MenuItem Menu::findItemByCodeconst 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 ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
