Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Building {
- string name,Address;
- int level;
- public:
- Building(string, string, int);
- ~Building();
- void print();
- string getName();
- string getAddress();
- int getLevel();
- };
- int Building::getLevel(){
- return level;
- }
- string Building::getAddress(){
- return Address;
- }
- string Building::getName(){
- return name;
- }
- void Building::print(){
- cout << "Building name is " <<name<<endl;
- cout << "Address is "<< Address<<endl;
- cout << "Number of levels are "<< level<<endl;
- }
- Building::Building(string a, string b, int c){
- name=a;
- Address=b;
- level=c;
- }
- Building::~Building(){
- cout << "This is the Building Destructor" <<endl;
- }
- class Restaurant:public Building{
- int deliveryList[5];
- int length;
- public:
- Restaurant(string, string, int);
- ~Restaurant();
- void printMenu();
- void MakeDelivery();
- void DeleteDelivery(int);
- };
- void Restaurant::DeleteDelivery(int a){
- int d=0;
- for(int i=0 ; i < length ;i++)
- if(deliveryList[i] == a){
- d = i;
- break; }
- for(int i=d ; i < length ;i++)
- deliveryList[i]=deliveryList[i+1];
- }
- void Restaurant::MakeDelivery(){
- cout << "Enter the meal you want : ";
- int a; cin >> a;
- cout<< endl;
- switch (a) {
- case 1:
- cout << "You choose Mansaf" << endl;
- deliveryList[length++] = a;
- break;
- case 2:
- cout << "You choose Kabseh" << endl;
- deliveryList[length++] = a;
- break;
- case 3:
- cout << "You choose Mashawee" << endl;
- deliveryList[length++] = a;
- break;
- case 4:
- cout << "You choose Molo5eh" << endl;
- deliveryList[length++] = a;
- break;
- case 5:
- cout << "You choose Sea Food" << endl;
- deliveryList[length++] = a;
- break;
- default:
- cout << "you enter wrong input" << endl;
- }}
- void Restaurant::printMenu(){
- cout << "1. Mansaf"<<endl;
- cout << "2. Kabseh"<<endl;
- cout << "3. Mashawee"<<endl;
- cout << "4. Molo5eh"<<endl;
- cout << "5. Sea Food"<<endl;
- }
- Restaurant::Restaurant(string a, string b, int c):Building(a,b,c){
- length=0;
- }
- Restaurant::~Restaurant(){
- cout << "This is the Resturant Destructor" <<endl;
- }
- class Hotel:protected Building{
- protected:
- int noOfroomPlevel ,noOfAvaRoom ;
- Restaurant rest;
- public:
- Hotel(string, string, int);
- ~Hotel();
- void print();
- void setAll(int,int);
- void checkIn();
- void checkOut();
- double Bill();
- void MakeDelivery();
- void DeleteDelivery(int);
- };
- void Hotel::DeleteDelivery(int a){
- rest.DeleteDelivery(a);
- }
- void Hotel::MakeDelivery(){
- rest.MakeDelivery();
- }
- void Hotel::checkOut(){
- noOfAvaRoom++;
- }
- void Hotel::checkIn(){
- noOfAvaRoom--;
- }
- void Hotel::setAll(int a,int b){
- noOfroomPlevel = a;
- noOfAvaRoom = b;
- }
- void Hotel::print(){
- Building::print();
- cout << "Number of rooms per level are : " << noOfroomPlevel << endl;
- cout << "Number of available rooms are : " << noOfAvaRoom << endl;
- cout<<"----------------------- \n";
- rest.printMenu();
- }
- Hotel::Hotel(string a, string b, int c):Building(a,b,c),rest(a,b,c){
- noOfroomPlevel = noOfAvaRoom = 0;
- }
- Hotel::~Hotel(){
- cout << "This is the Hotel Destructor" << endl;
- }
- int main(){
- Hotel h("Mareot", "Amman", 15);
- h.setAll(9,20);
- h.print();
- cout<<"----------------------- \n";
- h.MakeDelivery();
- cout<<"----------------------- \n";
- h.DeleteDelivery(3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement