Exercise 4.3.3: (back)

Question: What is the value of 

(cond
  [(<= n 1000) (* .040 1000)]
  [(<= n 5000) (+ (* 1000 .040) 
		  (* (- n 1000) .045))]
  [else (+ (* 1000 .040) 
	   (* 4000 .045)
	   (* (- n 10000) .055))])

       
when n is:
(a) 500   -> 40

    Solution: (* .040 1000)
              40

              
(b) 2800  -> 121

    Solution: (+ (* 1000 .040) (* (- n 1000) .045))
              (+ (* 1000 .040) (* (- 2800 1000) .045))
              (+ (* 1000 .040) (* 1800 .045))
              (+ 40 81)
              121
    
    
(c) 15000 -> 495

    Solution: (+ (* 1000 .040) (* 4000 .045) (* (- n 10000) .055))
              (+ (* 1000 .040) (* 4000 .045) (* (- 15000 10000) .055))
              (+ (* 1000 .040) (* 4000 .045) (* 5000 .055))
              (+ 40 180 275)
              495