Referenced from lesson Piecewise Functions (Spring, 2021)
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
fun cost(item):
ask:
| item == "hamburger" then: 6.0
| item == "onion rings" then: 3.5
| item == "fried tofu" then: 5.25
| item == "pie" then: 2.25
| otherwise: "Sorry, that’s not on the menu!"
end
end
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). Bootstrap:Algebra by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.