Problem Set 3
Purpose The purpose of this problem set is to practice with data definitions.
Finger Exercises HtDP/2e: 30, 31; 61, 64, 68, 71
Problem 1 Data Definitions
The four Ninja Turtles are Leonardo, Michaelangelo, Raphael, and Donatello. Write a data defintion for a Ninja Turtle. What is the template for a Ninja Turtle?
A percentage is a real number between 0 and 100. Write a data definition for percentage.
Problem 2 HtDP/2e: Exercise 60. Include test cases for the values of the constants you define.
Problem 3 HtDP/2e: Exercise 66. Include signature, purpose statement, and test cases.
a blue dot
a red dot
a black line between the blue and the red dots
a green dot on this line, 10% of the way along the line from the blue dot to the red dot. (Or, alternately, 90% of the way along the line in the reverse direction, from red to blue.)
Domain Knowledge (Geometry) To find the green point between the red and the blue one, cut the "distance" in each dimension to 90% and add the results to the respective coordinates of the red point.