Advertisement
dvdjaco

3.1

Feb 21st, 2012
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. # #!/usr/bin/python
  2. #
  3. # By dvdjaco
  4. # Exercise 3.1
  5. #
  6. # Rewrite your pay computation to give the employee 1.5 times the hourly rate for
  7. # hours worked above 40 hours.
  8.  
  9.  
  10. prompt_hours = 'Please enter the number of hours: '
  11. prompt_rate = 'Please enter the hourly rate: '
  12.  
  13. hours = float(raw_input(prompt_hours))
  14. rate = float(raw_input(prompt_rate))
  15.  
  16. if hours > 40:
  17.     gross_pay = (40.0 + (hours - 40) * 1.5) * rate
  18. else:      
  19.     gross_pay = float(hours) * float(rate)
  20.  
  21.  
  22. print 'The gross pay is ' + str(gross_pay)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement