Referenced from lesson Defining Functions
Directions: A dot is a solid circle of radius 50. Define a function called dot
, which makes dots of any color it is given
Contract and Purpose Statement |
Every contract has three parts…
# dot::___________________________->_____
# Consumes a color, and produces a solid, 50px-radius circle of that color.
Examples |
Write some examples, then circle and label what changes…
examples:
_____ (_________)is __________________________
_____ (__________)is ___________________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun dot(_____):
____________________________
end
Directions: A gym membership costs $25/month, with a one-time $75 signing fee. Define a function membership
that computes the total cost of a membership for a given number of months.
Contract and Purpose Statement |
Every contract has three parts…
# membership::(months :: Number)->Number
# Consumes a number of months, and produces the total cost of a membership given a signing fee of $75 and $25/month.
Examples |
Write some examples, then circle and label what changes…
examples:
____________ (___)is _____________
____________ (____)is ______________
end
Definition |
Write the definition, giving variable names to all your input values…
fun membership(months):
____________________
end
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Integrated Oklahoma by Jen Poole 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.