How To Design A Payroll System Of An Employee Using Single Inheritance - Wisdom Lighter

Tuesday, 22 May 2018

How To Design A Payroll System Of An Employee Using Single Inheritance




Q. You have to design a payroll system of an employee using single inheritance Create a base class employee which contain the
         Name
         Employee number
         Designation
Of employee by using get function.
Create a subclass salary which contains basic pay, Human Resource Allowance, Medical allowance and Profitability Fund by using get_data2 ().Net pay should calculated in a function calculation ().Provide a display function to display all data of employee.
Program should be enough dynamic it provide the facility to user to enter the no record of Employee which he or she desires?

Program

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

using namespace std;
class employee
{
          public:
                   string name,des;
                   intnum;
                  
                             void get_data()
                             {
                                      cout<<"enter your name"<<endl;
                             getline(cin,name);
                                      cout<<"enter designation"<<endl;
                                      getline(cin,des);
                                      cout<<"enter employee number"<<endl;
                                      cin>>num;
                             }
};
class salary: public employee
{
          private:
                   int bpay,ma,hra,pf,w,x,y,z;
                   public:
                             void get_data()
                            
                 {
                  
                                      cout<<"enter basic pay"<<endl;
                                      cin>>bpay;
                                      cout<<"enter human resource allowance"<<endl;
                                      cin>>hra;
                                      cout<<"enter profitability fund"<<endl;
                                      cin>>pf;
                                       calculate();
                                      func();
                             }
              void calculate()
              {
                   x=bpay-hra;
                   cout<<"after calculating basic pay alllowance"<<x<<endl;
                   y=bpay-ma;
                   cout<<"after calculating medecial allowance"<<y<<endl;
                   z=bpay-pf;
                   cout<<"after calculating prfitability fund"<<z<<endl;
                   w=hra+ma+pf;
                  
                                                }       
         
          intfunc()
                   {
                             int p;
                             cout<<"do you want to run again if yes the press 1 else press 0";
                             cin>>p;
                             if(p==1)
                             {
                                      get_data();
                             }
                                      else
                                      {
                                                return 0;
                                      }                           
                             }
                  
};
intmain()
{
          salary s1;
          s1.get_data();
          return 0;
}



3 comments:
Write comments
  1. For a long time entrepreneurs essentially composed their workers an always check straightforwardly from the principle organization checkbook. A couple of organizations paystubs to such an extreme as to have a different record that has been utilized for payroll to make bookkeeping a lot simpler at expense time. 

    ReplyDelete