;; The first three lines of this file were inserted by DrScheme. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname 7.7.5) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
; Exercise 7.7.5

; area-of-ring : number (inner-radius) number (outer-radius) -> number
; assumes inner-radius <= outer-radius

(check-expect (area-of-ring 0 0) 0)
(check-expect (area-of-ring 2 2) 0)
(check-within (area-of-ring 0 1) 3.14 .01)
(check-within (area-of-ring 0 2) 12.56 .01)
(check-within (area-of-ring 1 2) 9.42 .01)
; 4*3.14 for the outer circle, minus 3.14 for the inner circle
(check-within (area-of-ring 2 5) 65.94 .01)
; 25*3.14 for the outer circle, minus 4*3.14 for the inner circle
(define (area-of-ring inner-radius outer-radius)
  ; inner-radius number
  ; outer-radius number
  (- (* 3.14 outer-radius outer-radius) 
     (* 3.14 inner-radius inner-radius))
; Or, if you've already done problem 7.7.4,
;  (- (area-of-circle outer-radius)
;     (area-of-circle inner-radius))
; instead.
  )
