Program to store information of worker

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class worker
{
int wno;
char wname[30];
float hrwork,wgrate;
float totwage;
float calwg(float hrwork, float wgrate)
{
totwage=hrwork*wgrate*30;
return totwage;
}
public:
worker()
{
wno=1;
strcpy(wname," ");
hrwork=0.0;
wgrate=0.0;
totwage=0.0;
}
void takedata()
{
cout<<"enter workers number ";
cin>>wno;
cout<<" workers name ";
gets(wname);
cout<<"enter his hours worked per day ";
cin>>hrwork;
cout<<"enter his waggereate per hour ";
cin>>wgrate;
totwage=calwg(hrwork, wgrate);
}
void showdata()
{
cout<<"\n\nas per entered workers number "<<wno;
cout<<"\n name "<<wname;
cout<<"\n net pay per month"<<totwage;
}
};
void main()
{
clrscr();
worker w1;
w1.takedata();
w1.showdata();
getch();
}

Comments

Popular Posts