;; 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 area_of_ring) (read-case-sensitive #t) (teachpacks ((lib "testing.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "testing.ss" "teachpack" "htdp"))))) ;; Write a contract, purpose, example, and test for the ;; function below ;; define constant PI (define PI 3.14) ;; Contract: area-of-disk : number -> number ;; Purpose: to compute the area of a disk whose radius is r (define (area-of-disk r) (* PI (* r r))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Contract: area-of-ring : number number -> number ;; Purpose: to compute the area of a ring whose radius is ;; outer and whose hole has a radius of inner ;; Example: (area-of-ring 5 3) should produce 50.24 ;; Definition: [refines the header] (define (area-of-ring outer inner) (- (area-of-disk outer) (area-of-disk inner))) ;; Tests: (area-of-ring 5 3) ;; expected value 50.24