Friday, 7 March 2014

Employee Details Using Calss And Function

#include<iostream.h>
#include<conio.h>
Class Employee
{
int Basic;
Char Emp_No[20],Name[30];
Void Display();
float Calculate();
Void Getdata();
} ;

 
void main()
{
Employee Emp[100];
int i,n;
clrscr();
cout<<"Enter How Many Employees\n";
cin>>n;
for(i=0;i<n;i++)
  {
   Emp[i].Getdata();
   }
for(i=0;i<n;i++)
   {
    Emp[i].Display();
   }
 getch();
 
}

Void Employee::Getdata()
{
cout<<"Enter The Value OF Basic\n";
cin>>Basic;
cout<<"Enter The Employee Name\n";
cin>>Name;
cout<<"Enter No";
cin>>Emp_No;
}


float Employee::Calculate()
{
float Net_Pay,Ptax=40,DA=0.35 * Basic,PF=0.1* Basic;
Net_Pay=Basic +DA - Ptax - PF;
return(Net_Pay);
}

void Employee::Display()
{
cout<<"\n Employee No=" << Emp_No;
cout<<" Name:"<<Name;
cout<<" Net_Pay:"<<Calculate();
}


 

No comments:

Post a Comment