Blob


1 (define BRACKET2 1000)
2 (define BRACKET3 5000)
3 (define BRACKETINT1 0.04)
4 (define BRACKETINT2 0.045)
5 (define BRACKETINT3 0.05)
7 ;; interest-rate : number -> number
8 ;; Given amount, it computes the interest rate
9 ;; Divides the amount into brackets by using BRACKET2 and BRACKET3
10 ;; Gives the interest rate based on where the value falls between the two brackets
11 ;; BRACKETINT1, BRACKETINT2, BRACKETINT3 (bracket interest - the interest rate for
12 ;; a given bracket)
14 (define (interest-rate amount)
15 (cond
16 [(<= amount BRACKET2) BRACKETINT1]
17 [(<= amount BRACKET3) BRACKETINT2]
18 [(> amount BRACKET3) BRACKETINT3]))
20 ;; interest : number -> number
21 ;; Given the amount, calculates the total interest by multiplying the amount
22 ;; by the interest-rate
24 (define (interest amount)
25 (* amount (interest-rate amount)))