Exercise 4.4.2: (back)
;; constants (define hourly-rate 12) ;; tax : number -> number ;; Example (tax 120) -> 0 ;; Example (tax 350) -> 52.5 ;; Example (tax 700) -> 196 (define (tax pay) (cond [(<= pay 240) 0] [(<= pay 480) (tax-owed pay 15.0)] [(> pay 480) (tax-owed pay 28.0)])) ;; tax-owed : number number -> number (define (tax-owed pay rate) (* (/ rate 100) pay)) ;; netpay : number -> number ;; Example (netpay 15) -> 180 ;; Example (netpay 35) -> 255 ;; Example (netpay 70) -> 604.80 (define (netpay hours) (- (gross-pay hours) (tax (gross-pay hours)))) ;; gross-pay : number -> number (define (gross-pay hours) (* hours hourly-rate))