Objective: a problem for students to work through during the individual code review sessions. The problem will foster discussion about how to organize and think about writing a solution.
Problem: Your boss needs to determine the paycheck for several employees. The boss has a file containing a list of numerical employee ids, the number of hours the employee worked this week, and the employee's hourly pay rate (in dollars). If an employee works more than 40 hours, he gets paid time and a half for the overtime. (1.5*payrate*overtime_hours) If an employee works more than 60 hours, she gets paid double time for the overtime. (2*payrate*overtime_hours)
Example Input File:
employee_id1 num_hours1 pay_rate1
employee_id2 num_hours2 pay_rate2
...
employee_idn num_hoursn pay_raten
Your task: Determine the pay for each employee in the boss's data file.
Output Specification: Print a table of employee ids, pay rate, hours worked, and the calculated salary. The output should be neatly lined up.
Questions to ask yourself:
After you've coded a solution, you should look through your code and do some housekeeping.
Want to see a solution to this problem?