Guest User

Untitled

a guest
Nov 18th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. # U07_Ex01_overtime_calc
  2. #
  3. # Author: David Hanft
  4. # Course: Coding for OOP
  5. # Section: A3
  6. # Date: 13 Nov 2017
  7. # IDE: Python 3.6.2
  8. #
  9. # Assignment Info
  10. # Exercise: 1
  11. # Source: Python Programming
  12. # Chapter: 7
  13. #
  14. # Program Description
  15. # This program calculates the extra pay (time-and-a-half) for people who worked
  16. # above 40 hours in a given week.
  17. #
  18. # Algorithm (pseudocode)
  19. # def main():
  20. # input for number of hours
  21. # input for hourly rate
  22. # run calc function
  23. # def calc():
  24. # if hours > 40
  25. # time = hours-40/2+hours
  26. # total_wage = time * wage
  27. # else:
  28. # total_wage = time * wage
  29. # print total_wage
  30. def main():
  31. print('\nThis program calculates your total wage for the week.\n')
  32. hours = int(input('\nHours worked: '))
  33. wage = int(input('\nWage: '))
  34. calc(hours, wage)
  35. total_wage = calc(hours, wage)
  36. print('Total Wage:', total_wage)
  37. def calc(hours, wage):
  38. # time and a half calculation if the hours worked is over 40
  39. if hours > 40:
  40. hours = (hours-40)/2+hours
  41. total_wage = hours*wage
  42. else:
  43. total_wage = hours*wage
  44. return total_wage
  45. if __name__ == '__main__':
  46. main()
Add Comment
Please, Sign In to add comment