CECS 275  Lab 2 solution

$25.00

Category:

Description

5/5 - (6 votes)

This simple program calculates the gross pay of hourly employees. For 40 or fewer hours gross pay is simply hours * rate where hours is the amount of time worked and rate is the employee’s pay per hour. For over 40 hours overtime is paid. The overtime rate is 1.5.

 

This program reads from an input called input.txt. It contains the following data:

100 12 30

200 16 40

300 15 45

400 20 18

500 14 32

600 14 42

700 15 24

 

The three values are EmpID, Rate and Hours, respectively.

 

When no values are left for the file stream to read the while loop controlling the main process of input, calculating and output is stopped. The program then prints a total of the wages paid.

 

The program’s output should match the example below exactly.

ID        RATE      HOURS   WAGES

100        12        30    360.00

200        16        40    640.00

300        15        45    712.50

400        20        18    360.00

500        14        32    448.00

600        14        42    602.00

700        15        24    360.00

Total wages paid:         3482.50

 

Make sure everything lines up exactly and is in the correct column.

 

Deliverables:

Submit the cpp file and a screen shot of the output to Beachboard in Dropbox Lab2.

 

Due by the end of lab, Feb 7.