1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include<iostream>
#include<iomanip>
using namespace std;
const int EMP = 7;
void getInfo(int empId[EMP],double wagesEarned[EMP]);
void showInfo(const int empId[EMP], const double wagesEarned[EMP]);
int main()
{
cout <<"Welcome to the Payroll program" << endl;
cout <<"created by " << endl << endl;
getInfo();
showInfo();
system("pause");
return 0;
}
void getInfo()
{
const int EMP = 7;
int empId[EMP] = {565, 452, 789, 877, 845, 130, 758};
double payRate;
double hoursWorked;
double wagesEarned[EMP];
for(int count = 0;count <= 6; count++)
{
cout << "Employee number : " << empId[count] << endl;
cout << "\nEnter employee's hour : ";
cin >> hoursWorked;
while (hoursWorked < 0)
{
cout <<"Please enter a positive number: ";
cin >> hoursWorked;
}
cout << "Enter employee's pay rate: ";
cin >> payRate;
while (payRate < 6.00)
{
cout <<"Please enter a pay rate higher than $6.00: ";
cin >> payRate;
}
wagesEarned[count] = hoursWorked * payRate;
cout << "\n";
}
}
void showInfo()
{
const int EMP = 7;
int empId[EMP] = {565, 452, 789, 877, 845, 130, 758};
double wagesEarned[EMP];
for(int count = 0;count < count;count++)
{
cout << "Employee number : " << empId[count] << endl;
cout << "Employee gross wager : " << fixed << setprecision(2) <<showpoint << wagesEarned[count] << endl;
cout << "\n";
}
}
|