Tuesday, 9 June 2015

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;
    }

No comments:

Post a Comment