Referenced from lesson Solving Word Problems (Spring, 2021)
Write the contracts used to create each of the following collections of examples.
1
examples:
big-triangle(100, "red") is
triangle(100, "solid", "red")
big-triangle(200, "orange") is
triangle(200, "solid", "orange")
end
2
examples:
purple-square(15) is
rectangle(15, 15, "outline", "purple")
purple-square(6) is
rectangle(6, 6, "outline", "purple")
end
3
examples:
banner("Game Today!") is
text("Game Today!", 50, "red")
banner("Go Team!") is
text("Go Team!", 50, "red")
banner("Exit") is
text("Exit", 50, "red")
end
4
examples:
twinkle("outline", "red") is
star(5, "outline", "red")
twinkle("solid", "pink") is
star(5, "solid", "pink")
twinkle("outline", "grey") is
star(5, "outline", "grey")
end
5
examples:
half(5) is 5 / 2
half(8) is 8 / 2
half(900) is 900 / 2
end
These materials were developed partly through support of the National Science Foundation,
(awards 1042210, 1535276, 1648684, and 1738598).
Bootstrap:Integrated Oklahoma 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.