#include<iostream>
using namespace std;
int health=200, tax=300;
class employee
{
int basicpay, emp_id, hra, da, gpay, npay, deduction;
char emp_name[20];
public:
void getdata();
void grosspay();
void netpay();
void putdata();
};
void employee::getdata()
{
cout<<"\nEmployee ID : ";
cin>>emp_id;
cout<<"\nEnter Employee Name : ";
cin>>emp_name;
cout<<"\nEnter basic salary (above 500) : ";
cin>>basicpay;
cout<<"\nEnter DA : ";
cin>>da;
cout<<"\nEnter HRA : ";
cin>>hra;
}
void employee::grosspay()
{
gpay=basicpay+hra+da;
}
void employee::netpay()
{
deduction=health+tax;
npay=gpay-deduction;
}
void employee::putdata()
{
cout<<"\n"<<emp_id<<"\t\t"<<emp_name<<"\t\t"<<basicpay<<"\t\t"<<da<<"\t\t"<<hra<<"\t\t"<<gpay<<"\t\t"<<npay;
}
int main()
{
int n;
employee e[20];
cout<<"\n\nEnter the no.of Employee : ";
cin>>n;
for(int i=0;i<n;i++)
{
e[i].getdata();
e[i].grosspay();
e[i].netpay();
}
cout<<"\n\nEmployee ID\tEmployee Name\tBasic Pay\tDA\t\tHRA\t\tGross Pay\tNet pay";
for(int i=0;i<n;i++)
{
e[i].putdata();
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: