// This program stores, in an array, the hours worked by
// employees who all make the same hourly wage and then
// prints a list of employee numbers and their gross pay.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int NUM_EMPLOYEES = 5;
int hours[NUM_EMPLOYEES];
double payrate;
// Input the hours worked.
cout << "Enter the hours worked by ";
cout << NUM_EMPLOYEES << " employees\n";
cout << "who all earn the same hourly rate.\n";
// TODO: Write a FOR loop to input hours worked for each employee.
// Use a prompt for each employee that includes the
// employee number. You will need to declare your own loop
// control variable.
// Note: The first location in any array is index 0,
// while the first employee is #1 - be sure to
// account for that in your solution
for (int hours[5], k = 0; k <= 5; k++)
cout << "Employee #: 1" << endl;
// Input the hourly rate for all employees.
cout << "\nEnter the hourly pay rate for all the employees: ";
cin >> payrate;
// Display each employee's gross pay.
cout << "\nHere is the gross pay for each employee:\n";
cout << fixed << showpoint << setprecision(2);
// TODO: Write a FOR loop to calculate the gross pay
// for each employee. The loop should then display
// the employee number and gross pay for each employee.
Enter the hours worked by 5 employees
who all earn the same hourly rate.
Employee #1: 40
Employee #2: 38
Employee #3: 40
Employee #4: 35
Employee #5: 20
Enter the hourly pay rate for all the employees: 10.50
Here is the gross pay for each employee:
Employee #1: $420.00
Employee #2: $399.00
Employee #3: $420.00
Employee #4: $367.50
Employee #5: $210.00