???
???

Check for Mistakes in this Word Problem: turkey-price
Directions: The grocery store charges $2/pound for a turkey for the first 5 pounds, and then $1/pound for every pound after that. Write a function that takes in the weight of a turkey and returns how much it will cost.
Contract and Purpose Statement
Every contract has three parts ...
;
turkey-price:weightnumber
;
Return the price of the turkey.
Examples
Write some examples, then circle and label what changes ...
(EXAMPLE (
turkey-price3)(* 2 3)
(EXAMPLE (
turkey-price6)(+ 10 (* 1 (- 6 5)))
Definition
Write the definition, giving variable names to all your input values ...
(define (
turkey-priceweight)(
cond[
(< weight 5)(* 2 weight)
[
else(+ 10 (* 1 (- weight 5)))