Answer to Question #211358 in C++ for tatheer

Question #211358

A university wants to automate the cafeteria system you can help by identifying different classes along with their relationships. University café has different customers (Employees, Students) that visit it for buying different kinds of food. We want to make the system online so when a customer wants something he should order it through a server. Whenever a customer comes to café he/she orders the food from specific category. When a user wants to order something menu is displayed showing different food corners (FastFood, ProperMeal, Beverages). After the order is placed generate bill for the user according to the order he has placed. Identify the classes their relationship and function prototype of each class.


1
Expert's answer
2021-06-28T07:24:25-0400


#include <iostream>


using namespace std;
class Cafeteria{
    private:
        string name;
        string id;
        int age;
    public:
        void setName(string n){
            name=n;
        }
        void setID(string i){
            id=i;
        }
        void setAge(int a){
            age=a;
        }
        string getName(){
            return name;
        }
        string getID(){
            return id;
        }
        int getAge(){
            return age;
        }
};
class Student: public Cafeteria{
    private:
        string order;
    public:
        void setOrder(string ord){
            order=ord;
        }
        string getOrder(){
            return order;
        }
};
class Employee: public Cafeteria{
    private:
        string order;
    public:
        void setOrder(string ord){
            order=ord;
        }
        string getOrder(){
            return order;
        }
};
int main()
{
    Student s1;
    s1.setName("Juma");
    s1.setID("s123");
    s1.setAge(26);
    s1.setOrder("Pizza");
    
    Employee e1;
    e1.setName("Joan");
    e1.setID("e123");
    e1.setAge(21);
    e1.setOrder("Tea");


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS