Question: in c++ coding create a class called chef as the following with the main function to test and Run the code( main function is very

  1. in c++ coding

    create a class called chef as the following with the main function to test and Run the code( main function is very important)

    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.

  • #include

    using namespace std;

    class Order{

    private:

    // declaring data members

    int OrderID;

    int TableNumber;

    bool Ready;

    string Ordered_food;

    bool Delivered;

    public:

    // default constructor

    Order(){

    OrderID = -1;

    TableNumber = -1;

    Ordered_food = "";

    Ready = Delivered = false;

    }

    // parameterized constructor

    Order(int id, int tno, string order){

    OrderID = id;

    TableNumber = tno;

    Ordered_food = order;

    Delivered = Ready = false;

    }

    // set delivered to true

    void MarkDelivered(){

    Delivered = true;

    }

    // return delivery status

    bool isDelivered(){

    return Delivered;

    }

    // return ready status

    bool isReady(){

    return Ready;

    }

    // set Ready to true

    void MarkReady(){

    Ready = true;

    }

    // print order details

    void OrderDetails(){

    cout << "Order ID: " << OrderID << endl;

    cout << "Table Number: " << TableNumber << endl;

    cout << "Ordered food: " << Ordered_food << endl;

    cout << "Order Ready?: " << Ready << endl;

    cout << "Order Delivered?: " << Delivered << endl;

    }

    };

    int main()

    {

    // testing the above class

    Order order(1, 20, "Pasta");

    order.OrderDetails();

    order.MarkReady();

    order.OrderDetails();

    order.MarkDelivered();

    order.OrderDetails();

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