CS 1063  Lab 7:  Designing and Implementing a Class using ConditionalStatements

The Paycheck Class

Objectives

Hand-in Requirements

All projects and laboratories will be submitted electronically through webCT.  Zip up your entire project directory to submit as the source.  (Right click on the project folder and follow the SentTo link.)  The project folder should include the following:

Details

Write a program that reads in the name, hourly wage of an employee and how many hours the employee worked in the past week.  Be sure to accept fractional hours.  Compute the pay.  Any overtime work (over 40 hours per week) is paid at 150 percent of the regular wage.  Solve this problem by implementing a class Paycheck.  The Paycheck class has a constructor that accepts the name, hourly wage and the hours worked as parameters.  You should provide methods to return each of these (3 methods).  The method computePay should return the employee's pay for the previous week.  Also provide a toString method for easy printing that includes the name, hours worked, rate of pay and the amount of the paycheck.

The PaycheckTest Class

Read in 3 employees' information from the keyboard.  The first should work 38 hours, the second 40 hours and the third 45 hours.  You may choose the name and salary for the employees.  Print out the information (including salary) for each employee using the toString method for some and the accessor methods that return the instance data individually for others.