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