// This program stores, in an array, the hours worked by 5 // employees who all make different hourly wages (using parallel arrays) #include #include using namespace std; int main() { const int NUM_EMPLOYEES = 5; int hours[NUM_EMPLOYEES]; // Holds hours worked double payRate[NUM_EMPLOYEES]; // Holds pay rates // Input the hours worked. cout << "Enter the hours worked by " << NUM_EMPLOYEES; cout << " employees and their\n"; cout << "hourly pay rates.\n"; for (int index = 0; index < NUM_EMPLOYEES; index++) { cout << "Hours worked by employee #" << (index+1) << ": "; cin >> hours[index]; cout << "Hourly pay rate for employee #" << (index+1) << ": "; cin >> payRate[index]; } // Display each employee's gross pay. cout << "Here is the gross pay for each employee:\n"; cout << fixed << showpoint << setprecision(2); for (index = 0; index < NUM_EMPLOYEES; index++) { double grossPay = hours[index] * payRate[index]; cout << "Employee #" << (index + 1); cout << ": $" << grossPay << endl; } return 0; }