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
|
#include <iostream>
#include <iomanip>
using namespace std;
void displayEmployeeInfo(const int, const int[], const double[]);
void employeePay(const int, int[], double[], double[], double[]);
int main()
{
const int NUMBER_OF_EMPLOYEES = 7;
int empId[] = { 1234567,
2345678,
3456789,
4567890,
5679801,
6789012,
7890123 };
double wages[NUMBER_OF_EMPLOYEES];
double hours[NUMBER_OF_EMPLOYEES]{ 40,35,50,100,34,39,44 };
double payRate[]{ 15,12,13,14,11,10,15 };
employeePay(NUMBER_OF_EMPLOYEES, empId, hours, payRate, wages);
displayEmployeeInfo(NUMBER_OF_EMPLOYEES, empId, wages);
return 0;
} // end of int main()
void employeePay(const int NUMBER_OF_EMPLOYEES,
int empId[],
double hours[],
double payRate[],
double wages[])
{
for (int i = 0; i < sizeof(empId) / sizeof(int); i++)
{
wages[i] = payRate[i] * hours[i];
}
}//end of void employeePay
void displayEmployeeInfo(const int NUMBER_OF_EMPLOYEES,
const int empId[],
const double wages[])
{
cout << setprecision(2) << fixed;
cout << "Employee ID number and wages below: " << endl;
for (int i = 0; i < NUMBER_OF_EMPLOYEES; i++)
{
cout << "Wages for Employee #" << empId[i]
<< " = $"
<< wages[i]
<< endl;
}
}//end of displayEmployeeInfo
|