Guest User

Untitled

a guest
Dec 10th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Company XYZ & Co. pays all its employees $12 per hour. A typical employee works between 20 and 65 hours per week. Develop a program that determines the wage of an employee from the number of hours of work.
  2.  
  3. Exercise 2.3.1. Utopia's tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the program tax, which determines the tax on the gross pay.
  4.  
  5. Also define netpay. The program determines the net pay of an employee from the number of hours worked. Assume an hourly rate of $12
  6.  
  7.  
  8. answer from random site i found:
  9.  
  10. (define (wage h)
  11. (* 12 h))
  12. define (tax i)
  13. (* i 0.15)
  14. (define (netpay h)
  15. (- (wage h) (tax h)))
  16.  
  17. my answer:
  18.  
  19. (define (wage h)
  20. (* 12 h))
  21. (define (tax i)
  22. (* i 0.15))
  23. (define (netpay h)
  24. (- (wage h) (tax (wage h))))
Add Comment
Please, Sign In to add comment