/******************************************************************/
/*                                                                */
/*     CS 121: Principles of Computer Programming                 */
/*     Spring, 2011                                               */
/*                                                                */
/*     Assignment #1: Bob's Payroll                               */
/*     Produce a simple payroll report, using data obtained       */
/*     from the keyboard user; output is directed to a disk file  */
/*                                                                */
/*     Programmed by Ian Giese                                    */
/*                                                                */
/*     Due Wednesday, January 19                                  */
/*                                                                */
/******************************************************************/
#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

int main ()
{
    ofstream Report ("BobsPay.out");
    char Name[21];
    double Hours, Rate, Gross;
    char Answer;
    
    Report << "Bob's Payroll" << endl << endl;
    Report << left << setw(25) << "Employee" << setw(11) << "Hours"
           << setw(9) << "Rate" << "Gross" << endl << endl;
           
    do
    {
           cout << "Enter employee name: ";
           cin >> ws;
           cin.getline (Name, 20);
           cout << "How many hours? ";
           cin >> Hours;
           cout << "What's the pay rate? ";
           cin >> Rate;
           Gross = Rate * Hours;
           Report << left  << setw(20) << Name
                  << right << setw(10) << Hours
                  << right << setw(10) << Rate
                  << right << setw(10) << Gross << endl;
           cout << "Any more? (Y/N) ";
           cin >> ws;
           cin.get(Answer);
    }
    while (toupper(Answer) == 'Y');
    return 0;
}

