//program for salary payroll
#include<iostream.h>
#include<stdlib.h>
class employee
{
char name[50];
int number,worked_hours,PF,HRA,salary,net_salary;
public:
void read();
void calculate();
void display();
};
void employee::read()
{
cout<<"enter the employee details here";
cout<<"\n enter the employee name";
cin>>name;
cout<<"\n emter the employee number";
cin>>number;
cout<<"\n enter the employee worked hour";
cin>>worked_hours;
cout<<"\n enter the employee PF";
cin>>PF;
cout<<"\n enter the employee HRA";
cin>>HRA;
}
void employee::calculate()
{
salary=worked_hours*100;
net_salary=salary-PF-HRA;
}
void employee::display()
{
cout<<"\t\n"<<name;
cout<<"\t\n"<<number;
cout<<"\t\n"<<worked_hours;
cout<<"\t\n"<<PF;
cout<<"\t\n"<<HRA;
cout<<"\t\n"<<salary;
cout<<"\t\n"<<net_salary<<"\n";
system("pause");
}
void main()
{
employee payroll[3];
int i;
for(i=0;i<3;i++)
{
payroll[i].read();
payroll[i].calculate();
}
cout<<"\n____________________________________________________________";
cout<<"\n\n\t\t\tSALARY DETAILS";
cout<<"\n____________________________________________________________\n";
cout<<"\nname\tnumber\tworked hours\tPF\tHRA\tsalary\tnet_salary";
cout<<"\n____________________________________________________________";
for(i=0;i<3;i++)
{
payroll[i].display();
}
cout<<"\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\n\t";
}
sting23 -4 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.