Class 6 Objectives


At the end of today's class you should

KNOW:

BE ABLE TO:

Sample Exam Question:

Create a cleaner version of the following code by introducing helper functions and constants. The final code should have the same behavior as the original code

;;pipe-surface:  Number Number Number -> Number
;;consumes the length, diameter (width), and hole diameter of a pipe
;;and produces the surface area of the pipe (areas of the rings on each
;;end plus areas of outer and inner pipe walls)

(define (pipe-surface pipe-len pipe-diam hole-diam)
  (+  (* 2 (- (* 3.142 (/ pipe-diam 2) (/ pipe-diam 2))
              (* 3.142 (/ hole-diam 2) (/ hole-diam 2))))
      (* pipe-len 3.142 pipe-diam)
      (* pipe-len 3.142 hole-diam)))