Assignment 4

due Thursday 10 February at 01:00 AM

Write a program that will:

  1. Ask the user for their base hourly pay rate (such as $11/hour) and the hours worked this week.
  2. Output their weekly salary, including overtime pay.

If the hours worked is 40 or less, just use the base hourly rate. Any hours over 40 are paid "time and a half", or 1.5 times the base rate.

Here are a few sample runs of the program, but it should work for other numbers as well.

Enter base hourly pay rate ($/hour): 8.50
Enter hours worked this week: 46
Your paycheck is $416.50 (including 6.0 hours overtime)
Enter base hourly pay rate ($/hour): 8.50
Enter hours worked this week: 40
Your paycheck is $340.00
Enter base hourly pay rate ($/hour): 11.12
Enter hours worked this week: 24
Your paycheck is $266.88
Enter base hourly pay rate ($/hour): 11.12
Enter hours worked this week: 64
Your paycheck is $845.12 (including 24.0 hours overtime)

Some tips, for getting full credit:

  • Make sure you use appropriate indentation and alignment of braces.
  • Use constants (const keyword) where appropriate.
  • Include a comment at the top with your name and the date.
  • Your output format should be exactly as shown above, including the precision of digits after the decimal point.