//=========================================================
// File: HW_10c
// Programmer: Elaine Torrez
// Class: CMPR 121
//=========================================================
// Description:
// This program uses vectors to store employee
// hours and wages. It calculates and displays
// the gross pay for each employee.
//=========================================================
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main()
{
const int NUM_EMPLOYEES = 5;
vector<int> hours(NUM_EMPLOYEES);
vector<double> wage(NUM_EMPLOYEES);
int index;
cout << "Enter hours worked and hourly wage of each employee:\n\n";
for (index = 0; index < hours.size(); index++)
{
cout << "Hours for Employee #"
<< index + 1
<< ": ";
cin >> hours[index];
cout << "Wage for Employee #"
<< index + 1
<< ": ";
cin >> wage[index];
}
system("cls");
cout << fixed << setprecision(2);
cout << "Gross pay for each employee:\n\n";
for (index = 0; index < hours.size(); index++)
{
cout << setw(11)
<< "Employee #"
<< index + 1
<< setw(5)
<< "$"
<< setw(7)
<< hours[index] * wage[index]
<< endl;
}
cout << endl;
cout << "Employee #1 hours = "
<< hours.front()
<< endl;
cout << "Employee #5 hours = "
<< hours.back()
<< endl;
return 0;
}