Question: Program Language C++ The following problems is for building an application that simulates the restaurants operation. The customer asks the waiter for his/her orders. Accordingly,
Program Language C++
The following problems is for building an application that simulates the restaurants operation. The customer asks the waiter for his/her orders. Accordingly, the orders will go to the chef to start working on. The customer can place many orders through the waiter. The waiter asks the chef to prepare the orders. Once the chef completes the order, it will be delivered to the customer through the waiter. From the Object-Oriented perspective, there are three classes in the application namely the waiter, the order, and the chef. The waiter uses the functionality of the order class and the order class uses the functionality of the chef class.
We aim to create a system for a restaurant. A restaurant has a list of Waiters, Chefs, and Orders. 1- The Waiter class: Every waiter has a Name, ID, and a list of Orders (Assigned to him/her by the user of the system), and performs a number of orders The Waiter class should have a default constructor and a parameterized constructor. The Waiter has -but not limitedto - the following functions: - SetName() - SetID() - GetName() - GetID() - AssignOrders() This function aims to assign the orders for a given waiter. It is usually called in the main function to assign a set of orders for him/her. -DeliveredOrders() This function indicates the delivered orders to the customers. It flags what orders are delivered. - CheckStatus() This function checks the status of the orders inquiring if they have been delivered to the customer or not.
2- The Order class: The Order class contains all the details about the order including: - OrderID - TableNumer - Ready: Indicates whether the order is done by the chef and ready to be delivered. - Ordered_food: The type of food being ordered. - Delivered: Indicates whether the order has been delivered to the table or not. The Order has the following: - A Default Constructor setting the ID, Ordered food to empty strings, The delivered and ready status to false, and the TableNumber to -1. - A Parameterized Constructor indicating the order details assigned by the user in the main.cpp And assigns delivered and ready to False. - MarkDelivered() This function marks a given order as delivered. This function may be used to in conjunction with DeliveredOrders() in the waiters class. - IsDelivered() Returns true if the order was served to the customer. This function may used in conjunction with CheckDelivered() function in the Waiter's class. - IsReady() Returns true if the order was marked ready by the chef. This function may be used in conjunction with CheckReady() function in the Chef class. - MarkReady() Marks the order as ready to be served by the waiter. This function may be used in conjunction with CookedOrders() in the chef class. - OrderDetails() Prints the details of the order. It interacts with the user in a friendly way to get the users order details.
3- The Chef Class: A chef has a name, ID, a number of orders, and a list of orders assigned to him\ her. The Chef has the following functions: - SetName() - SetID() - GetName() - GetID() - AssignOrders() This function assigns the number of orders to the chef. - CookOrders() This function loops over the orders assigned to a chef and marks them as ready for delivery. The function is used in conjunction with MarkReady() . Also, it prints the details of the cooked orders. - CheckCooked() This function checks the number of cooked orders by every Chef. This function may be used in conjunction with CheckReady() in the Order class. For all the problems, please create a main function to test the functionality of the three classes. Given that you create a menu to input the order, it will be considered a bonus.
This is what I have written:
#include
using namespace std;
class Waiter { private: string Name; int ID; public: friend class Order; Waiter() { Name = "unassigned"; ID = 0;
} Waiter(string Name1, int id) { this->Name = Name1; this->ID = id; } void SetName(string name) { this->Name = name; } void SetID(int ID1) { this->ID = ID1; } int GetID() { return ID; } string GetName() { return Name; } void AssignOrders(int OrdersToWaiter) {
//Please answer this
} void DeliveredOrders() { //Please answer this } bool CheckStatus() {
//Please answer this
}
};
class Order { private: int TableNumber; bool Ready,Delivered; string Ordered_food ,OrderID; public: friend class Waiter; Order() { OrderID = ""; Ordered_food = ""; Ready = false; Delivered = false; TableNumber = -1; } Order(string Order_ID,string OrderedFood,int Table_Number) { OrderID = Order_ID; Ordered_food = OrderedFood; TableNumber = Table_Number; Ready = false; Delivered = false; } void MarkDelivered() { Delivered = true; } bool IsDelivered() { return Delivered; } bool IsReady() { return Ready; } void MarkReady() { Ready = true; } void OrderDetails(int tableNumber,string orderedfood,string orderid) { TableNumber = tableNumber; Ordered_food = orderedfood; OrderID = orderid; cout << "Your Table Number: " << tableNumber << " Your Order Id: " << orederid << " Your food: " << orderedfood << endl;
//Please answer this or edit it if it is incorrect
}
}; class Chef { private: string Name; int ID, NumberOfOrders; public: friend class Order; Chef() { Name = "unassigned"; ID = 0; NumberOfOrders = 0;
} Chef(string Name1, int id,int orders) { this->Name = Name1; this->ID = id; this->NumberOfOrders = orders; }
void SetName(string name) { this->Name = name; } void SetID(int ID1) { this->ID = ID1; }
int GetID() { return ID; } string GetName() { return Name; } void AssignOrders() {
//Please answer this
} void Cookorders() {
//Please answer this
} void CheckCooked() {
//Please answer this
} };
int main() {
//Please edit and add to the main() so it could run correctly and edit whatever is wrong.
Waiter waiter1("Alex", 100); Waiter waiter2("Jasmine", 200); Waiter waiter3("Mark", 300); Order order1("", "", 101); Order order2("", "", 102); Order order3("", "", 103); Chef chef1("Ramsey", 110,1); Chef chef2("Jack", 210,1); Chef chef3("Martin", 310,1);
cout << "------Restaurant------" << endl; cout << "Enter 1 to continue 2 to exit" << endl; int x; cin >> x; if (x == 1) { cout << "You chose to continue "; } else { cout << "Good Bye"; exit(0); } cout << "*****Menu*****"< cout << "Hello User. Welcome to 'Restaurant', Please tell your order to your waiter: "; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
