Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname 3.3.2-3.3.4) (read-case-sensitive #t) (teachpacks ((lib "convert.ss" "teachpack" "htdp"))) (htdp-settings #8(#t constructor repeating-decimal #f #t none #f ((lib "convert.ss" "teachpack" "htdp")))))
4 (define PI 3.14)
6 ;; area-of-circle : number -> number
7 ;; Computes the area of the circle given the radius
9 (define (area-of-circle radius)
10 (* PI (sqr radius)))
12 ;; area-of-ring : number number -> number
13 ;; Computes the area of a ring given the inner and outer radii
15 (define (area-of-ring inner outer)
16 (- (area-of-circle outer) (area-of-circle inner)))
18 ;; volume-cylinder : number number -> number
19 ;; Computes the volume of a cylinder given the radius and height
21 (define (volume-cylinder radius height)
22 (* (area-of-circle radius) height))
24 ;; area-cylinder : number number -> number
25 ;; Computes the surface area of a cylinder given the radius and height
27 (define (area-cylinder radius height)
28 (+ (area-of-circle radius)