Homework 2 - Classes

Due: Friday January 26, 2007 at 5pm

Name your file hw2.cpp and mail the file as an attachment to my Helios account. Hint: If using Pine on Helios, type just my username (mdanfor) in the To field and hit enter. If you have entered it correctly, my full name will come up. If it does not, then you have likely made a typo.

Use the same coding conventions as Homework 1.

Assignment

This assignment will create a small weekly payroll calculator using classes to store each employee's information. You will use the following menu for the assignment:
          Welcome to the CS222 Homework 2 Menu
  =======================================================
  1.  Input all employee data from the keyboard.
  2.  Edit a single employee's pay rate and hours worked.
  3.  Print the information and salary for all employees.
  0.  Exit
  =======================================================
  Enter selection: 
Option 1 will ask how many employees there are, allocate an array of employee class objects for that number of employees and prompt for each employee's name, ID number, hourly rate and hours worked.

Option 2 will only work if Option 1 has been selected. It will print out all of the employee information and ask the user which employee they wish to edit. The user will enter the index for the desired employee and be prompted for the new hourly rate and hours worked.

Option 3 will only work if Option 1 has been selected. It will print out all of the employee information and the calculated salary (hourly rate * hours worked) for each employee.

The employee class will have private member variables for the employee's name, ID number, hourly rate and hours worked. The hourly rate should account for pay rates that are not whole dollars, such as $10.50 per hour. The class will have public member functions for the following:

Additionally, your member functions should enforce the following value constraints: