Logo 
Search:

C++ Programming Articles

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

Program of Education System that maintains Institute Database using multilevel inheritance

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

Write a program that takes information about institute staff information for

1) Teacher code, name, subject and publication
2) Officer code, name and grade
3) Typist code, name, speed and daily wages

and displays it using multiple inheritance.

Code for Program of Education System that maintains Institute Database using multilevel inheritance in C++ Programming

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

class staff
{
  protected:
      int code;
      char name[20];
  public:
      void getstaff(void)
      {
    cout<<"\n\nEnter code :-";
    cin>>code;
    cout<<"Enter name :-";
    cin>>name;
      }
      void dispstaff(void)
      {
       cout<<"\nNAME       :-"<<name;
       cout<<"\nCODE       :-"<<code;
      }
};

class teacher : public staff
{
      char sub[20];
      char pub[20];
  public:
      void create(void)
      {
    getstaff();
    cout<<"Enter Subject :-";
    cin>>sub;
    cout<<"Enter Publication :-";
    cin>>pub;
      }
      void display(void)
      {
     dispstaff();
     cout<<"\nSUBJECT    :-"<<sub;
     cout<<"\nPUBLICATION:-"<<pub;
      }
};

class officer : public staff
{
       char grade;
   public:
    void create(void)
    {
       getstaff();
       cout<<"Enter Grade :-";
       cin>>grade;
    }
    void display(void)
    {
       dispstaff();
       cout<<"\nGRADE      :-"<<grade;
    }
};

class typist : public staff
{
       float speed;
  public:
      void gettypist(void)
      {
    getstaff();
    cout<<"Enter speed (wpm):-";
    cin>>speed;
      }
      void disptypist(void)
      {
    dispstaff();
    cout<<"\nSPEED      :-"<<speed;
      }
};


class casual : public typist
{
     float dailywages;
   public:
       void create(void)
    {
      gettypist();
      cout<<"Enter Daily Wages :-";
      cin>>dailywages;
    }
    void display(void)
    {
      disptypist();
      cout<<"\nDAILY WAGES:-"<<dailywages;
    }
};

void main()
{
clrscr();
teacher o1t[10];
casual  o1c[10];
officer  o1o[10];
int choice,i;
char test;
while(1)
{
int count;
start:
 clrscr();
   cout<<"\n=====EDUCATION INSTITUTION DATABASE=====\n\n\n";
   cout<<"Choose Category of Information\n";
   cout<<"1)   Teachers\n";
   cout<<"2)   Officer\n";
   cout<<"3)   Typist\n";
   cout<<"4)   Exit\n";
   cout<<"Enter your choice:-";
   cin>>choice;
   switch(choice)
   {
      case 1 :  while(1)
        {
        clrscr();
        cout<<"\n=====TEACHERS INFORMATION=====\n\n";
        cout<<"\nChoose your choice\n";
        cout<<"1) Create\n";
        cout<<"2) Display\n";
        cout<<"3) Jump to Main Menu\n";
        cout<<"Enter your choice:-";
        cin>>choice;
        switch(choice)
        {
         case 1 :  for(count=0,i=0;i<10;i++)
               {
                 cout<<endl;
                 o1t[i].create();
                 count++;
                 cout<<endl;
                 cout<<"\n\nAre you Interested in entering data\n";
                 cout<<"Enter y or n:-";
                 cin>>test;
                 if(test=='y' || test=='Y')
                continue;
                 elsegoto out1;
                 }
                 out1:
                 break;
         case 2 : for(i=0;i<count;i++)
               {
                cout<<endl;
                 o1t[i].display();
                 cout<<endl;
               }
               getch();
               break;
         case 3 : goto start;
         default: cout<<"\nEnter choice is invalid\ntry again\n\n";
         }
         }
      case 2 :   while(1)
         {
         clrscr();
        cout<<"\n=====OFFICERS INFORMATION=====\n\n";
        cout<<"\nChoose your choice\n";
        cout<<"1) Create\n";
        cout<<"2) Display\n";
        cout<<"3) Jump to Main Menu\n";
        cout<<"Enter your choice:-";
        cin>>choice;
        switch(choice)
        {
         case 1 : for(count=0,i=0;i<10;i++)
               {
                cout<<endl;
                o1o[i].create();
                 count++;
                 cout<<endl;
                 cout<<"\n\nAre you Interested in entering data\n";
                 cout<<"Enter y or n:-";
                 cin>>test;
                 if(test=='y' || test=='Y')
                continue;
                 elsegoto out2;
                 }
                 out2:
                 break;
         case 2 : for(i=0;i<count;i++)
               {
                cout<<endl;
                 o1o[i].display();
                 cout<<endl;
               }
               getch();
               break;
         case 3 : goto start;
         default: cout<<"\nInvalid choice\ntry again\n\n";
         }
         }
      case 3 :  while(1)
        {
        clrscr();
        cout<<"\n=====TYPIST INFORMATION=====\n\n";
        cout<<"\nChoose your choice\n";
        cout<<"1) Create\n";
        cout<<"2) Display\n";
        cout<<"3) Jump to Main Menu\n";
        cout<<"Enter your choice:-";
        cin>>choice;
        switch(choice)
        {
         case 1 : for(count=0,i=0;i<10;i++)
               {
                 cout<<endl;
                 o1c[i].create();
                 count++;
                 cout<<endl;
                 cout<<"\n\nAre you Interested in entering data\n";
                 cout<<"Enter y or n:-";
                 cin>>test;
                 if(test=='y' || test=='Y')
                continue;
                 elsegoto out3;
                 }
                 out3:
                 break;
         case 2 : for(i=0;i<count;i++)
               {
                 cout<<endl;
                 o1c[i].display();
                 cout<<endl;
               }
               getch();
               break;
         case 3 : goto start;
         default: cout<<"\nInvalid choice\ntry again\n\n";
         }
         }
      case 4 : goto end;
    }
 }
 end:
 }
  
Share: 



Easy Tutor
Easy Tutor author of Program of Education System that maintains Institute Database using multilevel inheritance 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

 

Other Interesting Articles in C++ Programming:


 
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!