Program to find netpay of an Employee

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class employee
{
int empno;
char ename[20];
float basic,hra,da;
float netpay;
float ctotal()
{
hra=basic*0.20;
da=basic*0.65;
return(basic+hra+da);
}
public:
void takedata()
{
cout<<"enter employee number ";
cin>>empno;
cout<<"enter his or her name ";
gets(ename);
cout<<"enter his basic pay ";
cin>>basic;
netpay=ctotal();
}
void display()
{
cout<<"\nas per the entered data\n";
cout<<"employee`s id "<<empno;
cout<<"\nemployee`s name "<<ename;
cout<<"\nemployee`s net pay "<<netpay;
}
};
void main()
{
clrscr();
employee E1;
E1.takedata();
E1.display();
getch();

Comments

Popular Posts