#include <iostream>
using namespace std;
class emp
{
public:
char name[30];
int id;
void getdata()
{
cout<<"\n Enter the Employee Name : ";
cin>>name;
cout<<"\n Enter the ID of Employee : ";
cin>>id;
}
};
class derive:public emp
{
int basic,HRA,DA;
int GP,NP,deduction,health=200,tax=300;
public:
void payment()
{
cout<<"\n Enter the Basic pay : ";
cin>>basic;
cout<<"\n Enter the HRA : ";
cin>>HRA;
cout<<"\n Enter the DA : ";
cin>>DA;
}
void grosspay()
{
GP=basic+HRA+DA;
}
void netpay()
{
deduction=health+tax;
NP=GP-deduction;
}
void display()
{
cout<<"\n"<<name<<"\t\t"<<id<<"\t\t"<<basic<<"\t\t"<<DA<<"\t"<<HRA<<"\t"<<GP<<"\t\t"<<NP;
}
};
int main()
{
derive obj;
cout<<"\n Employee Details...";
obj.getdata();
obj.payment();
obj.grosspay();
obj.netpay();
cout<<"\nEmployee Name\tEmployee ID\tBasic salary\tDA\tHRA\tGrosspay\tNetpay";
obj.display();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: