You are on page 1of 3

#include <iostream>

using namespace std;

int Employee(int& salary,int hours, char name[100]);


int Summary(int a, int b, int c, int d);
int hours1 , hours2 , hours3 , hours4;
char name1[100], name2[100],name3[100],name4[100];
int salary1,salary2,salary3,salary4,totalsalary;

int main()
{
cout <<"==============================="<<endl;
cout << "P A Y R O L L" << endl;
cout << endl;

cout << "Name of First Employee: ";


cin >> name1;
cout << "Number of Hours Worked: ";
cin >> hours1;
cout << endl;

cout << "Name of Second Employee: ";


cin >> name2;
cout << "Number of Hours Worked: ";
cin >> hours2;
cout << endl;

cout << "Name of Third Employee: ";


cin >> name3;
cout << "Number of Hours Worked: ";
cin >> hours3;
cout << endl;

cout << "Name of Fourth Employee: ";


cin >> name4;
cout << "Number of Hours Worked: ";
cin >> hours4;
cout << endl;

Employee(salary1,hours1,name1);
Employee(salary2,hours2,name2);
Employee(salary3,hours3,name3);
Employee(salary4,hours4,name4);

Summary(salary1,salary2,salary3,salary4);

return 0;
}

int Employee(int& salary,int hours, char name[100])


{
if (hours <= 160)
salary = hours *50;
else if (hours > 160 )
salary = (160*50)+((hours-160)*75);
cout << "Employee Name : " << name << endl;
cout << "Number of Hours worked : " << hours << endl;
cout << "Salary is : " << salary << endl;
return salary;
}

int Summary(int a, int b, int c, int d)


{
totalsalary = a+b+c+d;
cout <<"==============================="<<endl;
cout << "Payroll Summary"<<endl;

cout << "Total Salary is " << totalsalary <<endl;


cout <<"==============================="<<endl;
return totalsalary;
}

You might also like