Check for Mistakes in this Word Problem: circle-area
Directions: Write a function that returns the area of a circle given its diameter.
Contract and Purpose Statement
Every contract has three parts ...;
Takes the diameter of a circle and calculates the area by multiplying the square of the radius by pi.
Write some examples, then circle and label what changes ...(EXAMPLE (
circle-area10)(* (sqr (/ 10 2)) pi)(EXAMPLE (
circle-area50)(* (sqr (/ 50 2)) pi)
Write the definition, giving variable names to all your input values ...(define (
areadiameter)(* (sqr diameter) pi))