6

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include<conio.

h>
#include<iostream.h>
class employee
{
private:
float basic,hra,da,salary;
int empno;
char ename[20];
public:
void getinfo()
{
cout<<"Enter Name:"<<endl;
cin>>ename;
cout<<"Enter employee number:"<<endl;
cin>>empno;
cout<<"Enter basic salary"<<endl;
cin>>basic;
cout<<"Enter dearness allowence:"<<endl;
cin>>da;
cout<<"Enter house rental alloweance:";
cin>>hra;
float calcualte();
}
float calculate()
{
da=basic*(da/100.00);
hra=basic*(hra/100.00);
salary=basic+hra+da;
return salary;
}
void displayinfo()
{
float sal=calculate();
cout<<"Name is:"<<ename<<endl;
cout<<"Employee number is:"<<empno<<endl;
cout<<"Basic salary:"<<basic<<endl;
cout<<"Dearness Allowence:"<<da<<endl;
cout<<"House Rental Allowence:"<<hra<<endl;
cout<<"final salary is:"<<sal;
}
}s1;
void main()
{
clrscr();
s1.getinfo();
s1.displayinfo();
getch();
}

You might also like