Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #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 12687dd9 2023-08-04 jrmu (define PI 3.14)
5 12687dd9 2023-08-04 jrmu
6 12687dd9 2023-08-04 jrmu ;; area-of-circle : number -> number
7 12687dd9 2023-08-04 jrmu ;; Computes the area of the circle given the radius
8 12687dd9 2023-08-04 jrmu
9 12687dd9 2023-08-04 jrmu (define (area-of-circle radius)
10 12687dd9 2023-08-04 jrmu (* PI (sqr radius)))
11 12687dd9 2023-08-04 jrmu
12 12687dd9 2023-08-04 jrmu ;; area-of-ring : number number -> number
13 12687dd9 2023-08-04 jrmu ;; Computes the area of a ring given the inner and outer radii
14 12687dd9 2023-08-04 jrmu
15 12687dd9 2023-08-04 jrmu (define (area-of-ring inner outer)
16 12687dd9 2023-08-04 jrmu (- (area-of-circle outer) (area-of-circle inner)))
17 12687dd9 2023-08-04 jrmu
18 12687dd9 2023-08-04 jrmu ;; volume-cylinder : number number -> number
19 12687dd9 2023-08-04 jrmu ;; Computes the volume of a cylinder given the radius and height
20 12687dd9 2023-08-04 jrmu
21 12687dd9 2023-08-04 jrmu (define (volume-cylinder radius height)
22 12687dd9 2023-08-04 jrmu (* (area-of-circle radius) height))
23 12687dd9 2023-08-04 jrmu
24 12687dd9 2023-08-04 jrmu ;; area-cylinder : number number -> number
25 12687dd9 2023-08-04 jrmu ;; Computes the surface area of a cylinder given the radius and height
26 12687dd9 2023-08-04 jrmu
27 12687dd9 2023-08-04 jrmu (define (area-cylinder radius height)
28 12687dd9 2023-08-04 jrmu (+ (area-of-circle radius)