;; Updated Monday Sept 13th. ;; Contract: number -> number ;; Purpose: determine a yearly interest rate based on amount ;; The interest rate is 0.04 for amounts between 0 and ;; 1000 (incl), 0.045 for amounts between 1000 and 5000 (incl), ;; and 0.05 for larger amounts. ;; Examples: (interest-rate 500) -> 0.04 ;; (interest-rate 1000) -> 0.04 ;; (interest-rate 10000) -> 0.05 (define (interest-rate m) (cond [(< m 0) 'NegativeAmount] [(>= 1000 m) .04] [(>= 5000 m) .045] [else .05] )) ;; Tests (check-expect (interest-rate 500) 0.04) (check-expect (interest-rate 1000) 0.04) (check-expect (interest-rate 3000) 0.045) (check-expect (interest-rate 10000) 0.05) (check-expect (interest-rate 0) 0.04) (check-expect (interest-rate -500) 'NegativeAmount) ;; Write a function that, given an amount of money, ;; computes the interest on that amount that accumulates in a year