Programming Assignment #2: A Payroll Program

 

The task:

Your company pays its hourly workers once a week. An hourly worker’s gross pay is basically his/her work hours that week multiplied by his/her regular hourly pay rate. However, after the first 40 work hours of the week, each additional work hour is paid at an overtime rate that is 1.5 times of the regular hourly rate.

The net pay of an hourly worker may be less than the gross pay because of the union due. An hourly worker who earns $200.0 or more a week must pay union due, which is deducted from his/her gross pay. If the employee is less than 60 years old, the union dues are $15.0 per week; otherwise the union dues are $5.0 per week.

Write a payroll program that will determine and report the amount of (1) the gross pay, (2) the union due, and (3) the net pay respectively for the hourly worker.

 

Analysis and Program Design:

Your program should prompt the user to provide the information of (1) his/her age, (2) the number of work hours that week, and (3) his/her regular hourly pay rate. You should read in and store the information in some appropriately declared variables.

There are several important constants related to the calculation: the union dues ($5.0 for the senior and $15.0 for people younger than 60 years old), the threshold of weekly earning ($200.0) requiring the union due, the threshold of work hours (40 hours) requiring overtime pay, and the overtime rate (1.5 times the regular hourly rate).

You need to use conditional statements like if … else in your program to correctly determine the amount of the gross pay, union due, and net pay based on the rules described above and the age, the regular hourly pay rate, and the number of work hours at work.

 

Framework of your Python program:

–Read in the age, work hours, and regular hourly rate, and

  convert and store the numerical information in appropriate variables

–Compute the gross pay and store it in a variable

–Compute the union due and store it in a variable

–Compute the net pay and store it in a variable

–Display the amount of gross pay, the union due, and the net pay