Referenced from lesson Piecewise Functions

Alice has hired you to improve some code used at the restaurant. The code we’ll be improving on is shown below.

Read through the code line-by-line with your partner before writing down your observations in the tables below.

; cost : String -> Number
; given a item, produce the cost of that item
(define (cost item)
  (cond
    [(string=? item "hamburger")     6.00]
    [(string=? item "onion rings")   3.50]
    [(string=? item "fried tofu")    5.25]
    [(string=? item "pie")           2.25]
    [else "Sorry, that's not on the menu!"]))

1) I notice…​

 

 

 

 

 

 

 

 

 

 

2) I wonder…​

 

 

 

 

 

 

 

 

 

 

3) Familiar things I see in the code

 

 

 

 

 

 

 

 

 

 

4) Unfamiliar things I see in the code

 

 

 

 

 

 

 

 

 

 

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Algebra by Emmanuel Schanzer, Jen Poole, Ed Campos Jr, Flannery Denny, and Dorai Sitaram is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.