SYSC 3101 Lecture 1: Simple Racket Functions

33 views1 pages

Document Summary

;;calculate the area of a circle with the specified radius. (define (area-of-circle radius) (* pi radius radius)) ;;calculate teh area of a ring whose radius is outer and. ;; whose hole has a radius of inner. (define (area-of-ring outer inner) (- (area-of-circle outer) (area-of-circle inner))) ;;a-switch 1 with x (define (f x) (+ x 10)) ;;b - add open and close brackets (define(g x) (+ x 10)) ;;c - move open bracket (define (h x) (+ x 10)) ;;;exercise 3 (define (sum-coins p n d q) (+ (* p 1) (* n 5) (* d 10) (* q 25))) ;; calculate the surface area of a cyclinder (define (area-of-cylinder radius height) (+ (* pi 2 radius height) (* pi 2 radius radius))) ;;;exercise 5 (define (area-of-curved-surface length inner thickness) (* pi 2 length (+ inner (+ inner thickness)))) (define (area-of-bases inner thickness) (* 2 pi (- (expt (+ inner thickness) 2) (expt inner 2))))

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents