#include
<iostream.h>
#include
<conio.h>
class
EMPLOYEE //implments the EMPLOYEE class
{
private:char
employee_number[10],
employee_name[10];
float
basic,DA,IT,net_sal;
public:void
Read_Data();
void
Calculate_Net_Salary(); //calculates the net salary
void
Display_Data(); //Displays the data
};
void
EMPLOYEE::Read_Data()
{
cout
<< "Enter the Employee Number and Name" << endl;
cin
>> employee_number >> employee_name;
cout
<< "Enter the Basic Salary" << endl;
cin
>> basic;
}
void EMPLOYEE::Calculate_Net_Salary()
{
float
Gross_Sal;DA = (52*basic)/100;
Gross_Sal
= basic+DA;
IT =
(30*Gross_Sal)/100;
net_sal
= Gross_Sal-IT;
}
void
EMPLOYEE::Display_Data()
{
cout << "Emp Name:" <<
employee_name << "\tEmp Number:" <<employee_number;
cout << "\t Net Salary:" <<
net_sal << endl;
}
void main()
{
int n,i;
clrscr();
cout << "Enter the number of employees: " ;
cin >> n;
cout << endl;
EMPLOYEE Emp[10];
cout << "Enter employee data"
<< endl;
for(i=0; i<n; i++)
{
Emp[i].Read_Data();
for(i=0;i<n;i++)
{
Emp[i].Calculate_Net_Salary();
Emp[i].Display_Data();
}
dont run
ReplyDelete