Payroll report from a file

This assignment will test your ability to process information read from a fixed format sequential file.

The file payrollFile.txt contains ten records:

10.00 42.0 George Washington
12.00 35.1 Martha Washington
12.50 38.0 Abraham Lincoln
 7.25 44.0 Mary Lincoln
14.35 32.0 John F. Kennedy
16.00 37.5 Jacqueline Kennedy
18.00  9.5 Dwight D. Eisenhower
18.00 22.5 Mamie Eisenhower
13.00 55.0 Harry Truman
12.00 25.0 Bess Truman
Each record contains three fields:

Field 1: columns 1-5, rate of pay
Field 2: columns 7-10, hours worked
Field 3: column 11 to end, name
Your assignment is to write a program that reads the payrollFile.txt file and displays a payroll report showing each person's gross pay and the total payroll for the company.

You will use the string functions or methods to extract the values of the rate, hours, and name fields from the records as they are read. Use the format function to display the results as currency with dollar signs. (Do not worry about lining up the report columns at this time).

When your program is working, turn in a screen shot of it running and the listing.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.