Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Object Oriented ProgrammingRSS Feeds

Program to illustrate an example of containership

Posted By: Easy Tutor     Category: C++ Programming     Views: 7204

A C++ Program to illustrate an example of containership.

Code for Program to illustrate an example of containership in C++ Programming

 #include<iostream.h>
 #include<stdio.h>
 #include<conio.h>

 constint length=50;

 /*************************************************************************///------------------------------  student  ------------------------------///*************************************************************************/class student
    {
       private:
        char school[length];
        char degree[length];

       public:
        void get_education();
        void show_education();
    };


 /*************************************************************************///------------------------------  employee  -----------------------------///*************************************************************************/class employee
    {
       private:
        char name[length];
        char id_number[length];

       public:
        void get_identification();
        void show_identification();
    };

 /*************************************************************************///------------------------------  manager  ------------------------------///*************************************************************************/class manager
    {
       private:
        char title[length];
        double club_dues;

        student stu;
        employee emp;

       public:
        void get_data();
        void show_data();
    };

 /*************************************************************************///------------------------------  scientist  ----------------------------///*************************************************************************/class scientist
    {
       private:
        int publications;

        student stu;
        employee emp;

       public:
        void get_data();
        void show_data();
    };

 /*************************************************************************///------------------------------  labour  -------------------------------///*************************************************************************/class labour
    {
       private:
        employee emp;

       public:
        void get_data();
        void show_data();
    };


 /*************************************************************************///-----------------------  get_education( )  ----------------------------///*************************************************************************/void student::get_education()
    {
       cout<<"\t Enter the School Name : ";
       gets(school);

       cout<<"\t Enter the highest Degree earned : ";
       gets(degree);
    }

 /*************************************************************************///-----------------------  show_education( )  ---------------------------///*************************************************************************/void student::show_education()
    {
       cout<<"\t School Name : "<<school<<endl;
       cout<<"\t Highest Degree earned : "<<degree<<endl;
    }

 /*************************************************************************//*************************************************************************///---------------------------  employee  --------------------------------///*************************************************************************//*************************************************************************//*************************************************************************///----------------------  get_identification( )  ------------------------///*************************************************************************/void employee::get_identification()
    {
       cout<<"\t Enter the Name : ";
       gets(name);

       cout<<"\t Enter the ID Number : ";
       gets(id_number);
    }

 /*************************************************************************///----------------------  show_identification( )  -----------------------///*************************************************************************/void employee::show_identification()
    {
       cout<<"\t Name : "<<name<<endl;
       cout<<"\t ID Number : "<<id_number<<endl;
    }

 /*************************************************************************//*************************************************************************///----------------------------  manager  --------------------------------///*************************************************************************//*************************************************************************//*************************************************************************///----------------------------  get_data( )  ----------------------------///*************************************************************************/void manager::get_data()
    {
       emp.get_identification();

       cout<<"\t Enter the Title : ";
       gets(title);

       cout<<"\t Enter the Club Dues : ";
       cin>>club_dues;

       stu.get_education();
    }

 /*************************************************************************///----------------------------  show_data( )  ---------------------------///*************************************************************************/void manager::show_data()
    {
       emp.show_identification();

       cout<<"\t Title : "<<title<<endl;
       cout<<"\t Club Dues : "<<club_dues<<endl;

       stu.show_education();
    }

 /*************************************************************************//*************************************************************************///----------------------------  scientist  ------------------------------///*************************************************************************//*************************************************************************//*************************************************************************///----------------------------  get_data( )  ----------------------------///*************************************************************************/void scientist::get_data()
    {
       emp.get_identification();

       cout<<"\t Enter the Number of Publications : ";
       cin>>publications;

       stu.get_education();
    }

 /*************************************************************************///---------------------------  show_data( )  ----------------------------///*************************************************************************/void scientist::show_data()
    {
       emp.show_identification();

       cout<<"\t Number of Publications : "<<publications<<endl;

       stu.show_education();
    }

 /*************************************************************************//*************************************************************************///-----------------------------  labour  --------------------------------///*************************************************************************//*************************************************************************//*************************************************************************///----------------------------  get_data( )  ----------------------------///*************************************************************************/void labour::get_data()
    {
       emp.get_identification();
    }

 /*************************************************************************///---------------------------  show_data( )  ----------------------------///*************************************************************************/void labour::show_data()
    {
       emp.show_identification();
    }


 main()
    {
       clrscr();

       manager m;
       scientist s;
       labour l;

       cout<<"\n *********  Manager  *********"<<endl;
       m.get_data();

       cout<<"\n *********  Scientist  ********"<<endl;
       s.get_data();

       cout<<"\n *********  Labour  ********"<<endl;
       l.get_data();

       getch();
       clrscr();

       cout<<"\n *********  Manager  *********"<<endl;
       m.show_data();

       cout<<"\n *********  Scientist  ********"<<endl;
       s.show_data();

       cout<<"\n *********  Labour  ********"<<endl;
       l.show_data();

       getch();
       return 0;
    }
  
Share: 


Didn't find what you were looking for? Find more on Program to illustrate an example of containership Or get search suggestion and latest updates.

Easy Tutor
Easy Tutor author of Program to illustrate an example of containership is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!