Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program to maintain employee information also illustrate virtual class and inheritance

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

Write a Program to maintain employees information. Program should also illustrate Virtual Class and Inheritance concept.

Code for Program to maintain employee information also illustrate virtual class and inheritance in C++ Programming

/*www.DailyFreeCode.comDownload Projects, Sourcecodes, Tips and Tricks, Interview FAQs, Hotlinks and more....Logon to www.DailyFreeCode.com*/



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

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

class account : virtualpublic person
{
  protected:
       float pay;
  public:
       void getpay(void)
       {
     cout<<"\nEnter Pay amount :-";
     cin>>pay;
       }
       void dispay(void)
       {
      cout<<"\nPAY       :-"<<pay;
       }
};

class admin : virtualpublic person
{
  protected:
       int experience;
  public:
       void getexpr(void)
       {
      cout<<"\nEnter Experience in yrs :-";
      cin>>experience;
       }
       void dispexpr(void)
       {
      cout<<"\nEXPERIENCE:-"<<experience;
       }
};

class master : public account, public admin
{
    public:
    void create(void)
    {
       cout<<"\n\n=====GETDATA IN=====\n";
       getdetail();
       getpay();
       getexpr();
    }

    void display(void)
    {
      cout<<"\n\n=====DISPLAY DETAILS=====\n";
      dispdetail();
      dispay();
      dispexpr();
    }

    void update(void)
    {
      cout<<"\n\n=====UPDATE DETAILS=====\n";
      cout<<"\nChoose detail you want to update\n";
      cout<<"1)  NAME\n";
      cout<<"2)  CODE\n";
      cout<<"3)  EXPERIENCE\n";
      cout<<"4)  PAY\n";
      cout<<"Enter your choice:-";
      int choice;
      cin>>choice;
      switch(choice)
      {
        case 1 : cout<<"\n\nEnter name : -";
             cin>>name;
             break;
        case 2 : cout<<"\n\nEnter code :-";
             cin>>code;
             break;
        case 3 : cout<<"\n\nEnter pay :-";
             cin>>pay;
             break;
        case 4 : cout<<"\n\nEnter Expereince :-";
             cin>>experience;
             break;
        default: cout<<"\n\nInvalid choice\n\n";
      }
    }
};

void main()
{
clrscr();
master ob1;
int choice;
while(1)
{
clrscr();
   cout<<"\n=====MASTER DATABASE=====\n\n";
   cout<<"\nChoose Operation you want to perform\n";
   cout<<"1)  Create  Record\n";
   cout<<"2)  Display Record\n";
   cout<<"3)  Update  Record\n";
   cout<<"4)  Exit\n";
   cout<<"Enter your choice:-";
   cin>>choice;
   switch(choice)
   {
     case 1 : ob1.create();
          break;
     case 2 : ob1.display();
          getch();
          break;
     case 3 : ob1.update();
          break;
     case 4 : gotoout;
    default : cout<<"\n\nInvalid Choice\nTry Again\n\n";
   }
}
out:
}
  
Share: 



Easy Tutor
Easy Tutor author of Program to maintain employee information also illustrate virtual class and 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!