Referenced from lesson Piecewise Functions

Alice’s code has some new elements we haven’t seen before, so let’s experiment a bit to figure out how it works! Open the “Alice’s Restaurant starter file, click “Run”, and try using the cost function in the Interactions window.

1) What does (cost "hamburger") evaluate to?

2) What does (cost "pie") evaluate to?

3) What if you ask for (cost "fries")?

4) Explain what the function is doing in your own words.

5) What is the function’s name? Domain? Range?

6) What is the name of its variable?

7) Alice says onion rings have gone up to $3.75. Change the cost function to reflect this.

8) Try adding menu items of your own. What’s your favorite?

9) For an unknown food item, the function produces the String "That’s not on the menu!"

Is this a problem? Why or why not?

10) Suppose Alice wants to calculate the price of a hamburger, including a 5% sales tax. Draw a Circle of Evaluation for the expression below.

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.