Design Recipe Team Challenge! 1)Every team submits their answer in writing. 2)Every team can gain...

37
Design Recipe Team Challenge!

Transcript of Design Recipe Team Challenge! 1)Every team submits their answer in writing. 2)Every team can gain...

Design Recipe Team Challenge!

Design Recipe Team Challenge!

1) Every team submits their answer in writing.2) Every team can gain points for every

question.3) Wrong answers are worth $50. Wild

guesses and blank answers are worth $0!4) Each round is worth more money!

The rulesThe rules

Design Recipe StepsDesign Recipe Steps

Step 1 - State the ProblemStep 2 - Define the DataStep 3 - Write the ContractStep 4 - Make ExamplesStep 5 - Take InventoryStep 6 - CodeStep 7 - Test

Step 1 - State the ProblemStep 2 - Define the DataStep 3 - Write the ContractStep 4 - Make ExamplesStep 5 - Take InventoryStep 6 - CodeStep 7 - Test

$100 - Step 2$100 - Step 2

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

$100 - Step 2$100 - Step 2

$100 - Step 2$100 - Step 2

Problem StatementYou’re buying tile for a new bathroom, and you must convert the measurements from feet to inches. Write a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Problem StatementYou’re buying tile for a new bathroom, and you must convert the measurements from feet to inches. Write a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

$100 - Step 2$100 - Step 2

$100 - Step 2$100 - Step 2

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Data Definition:Strings like “Rasheem” and “Vinelle”Data Definition:Strings like “Rasheem” and “Vinelle”

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

$100 - Step 2$100 - Step 2

$100 - Step 2$100 - Step 2Problem StatementYou go out to dinner and everything is perfect, but how much do you tip the waiter? Write a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip. (to calculate tax, take the cost of the meal and multiple it by the tax, then divide by 100)

Problem StatementYou go out to dinner and everything is perfect, but how much do you tip the waiter? Write a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip. (to calculate tax, take the cost of the meal and multiple it by the tax, then divide by 100)

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

$100 - Step 2$100 - Step 2

Data Definition:Strings like “red”, “blue”, “yellow”Data Definition:Strings like “red”, “blue”, “yellow”

Problem Statement

Write a function ‘circle30’, which takes a color as input, and outputs a solid circle of the appropriate color. The radius of the circle must always be 30.

Problem Statement

Write a function ‘circle30’, which takes a color as input, and outputs a solid circle of the appropriate color. The radius of the circle must always be 30.

$100 - Step 2$100 - Step 2

$100 - Step 2$100 - Step 2

Problem StatementWrite a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Problem StatementWrite a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Data Definition:Numbers like 30, 54, 102Data Definition:Numbers like 30, 54, 102

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

$100 - Step 2$100 - Step 2

$100 - Step 2$100 - Step 2Problem Statement100 is the smallest three-digit number, and 999 is the biggest. Anything in between these numbers is also three digits. Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Problem Statement100 is the smallest three-digit number, and 999 is the biggest. Anything in between these numbers is also three digits. Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Data Definition:Numbers like 30, 574, 102Data Definition:Numbers like 30, 574, 102

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

$100 - Step 2$100 - Step 2

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; feet->inches : Number -> Number; converts the input from feet to inches

Data Definition:Strings like “Rasheem” and “Vinelle”Data Definition:Strings like “Rasheem” and “Vinelle”

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; hello : String -> String; takes a name and prints “Hello, <name>”

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem Statement

Write a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

Problem Statement

Write a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; tip : Number Number -> Number; given a price and a tip percentage, return the tip amount

Data Definition:Numbers like 30, 54, 102Data Definition:Numbers like 30, 54, 102

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Data Definition:Numbers like 30, 574, 102Data Definition:Numbers like 30, 574, 102

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

$200 - Step 3$200 - Step 3

Contract+Purpose Statement; 3digits : Number -> Boolean; returns true if the input has 3 digits

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Examples; (triple 5) => 15

Examples; (triple 5) => 15

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; feet->inches : Number -> Number; converts the input from feet to inches

Examples; (feet->inches 6) => 75

Examples; (feet->inches 6) => 75

Data Definition:Strings like “Rasheem” and “Vinelle”Data Definition:Strings like “Rasheem” and “Vinelle”

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; hello : String -> String; takes a name and prints “Hello, <name>”

Example; (hello “Jose”) => “hello, Jose”

Data Definition:Numbers like 20, 567, 0, 18Data Definition:Numbers like 20, 567, 0, 18

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; tip : Number Number -> Number; given a price and a tip percentage, return the tip amount

Example:; (tip 50 20) => 10

Data Definition:Numbers like 30, 54, 102Data Definition:Numbers like 30, 54, 102

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Example:(blue-rect 10 40) =>

Data Definition:Numbers like 30, 574, 102Data Definition:Numbers like 30, 574, 102

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

$300 - Step 4$300 - Step 4

Contract+Purpose Statement; 3digits : Number -> Boolean; returns true if the input has 3 digits

Example:; (3digits 173) => true

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

Problem StatementWrite a function ‘triple’, which takes in a number as input and outputs a number three times its size.

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Contract+Purpose Statement; triple : Number -> Number; multiplies the input by 3

Examples; (triple 5) => 15

Examples; (triple 5) => 15

(define (triple x)…function body…)

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

Problem StatementWrite a function “feet->inches” which takes a length (in feet) and returns a length (in inches).

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; feet->inches : Number -> Number; converts the input from feet to inches

Examples; (feet->inches 6) => 75

Examples; (feet->inches 6) => 75

(define (feet->inches f)…function body…)

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

Problem StatementWrite a function ‘hello’, which takes in a name as input and prints out “Hello, _____” for that person, filling in their name.

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; hello : String -> String; takes a name and prints “Hello, <name>”

Example; (hello “Jose”) => “hello, Jose”

(define (hello name)…function body…)

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

Problem StatementWrite a function “tip”, which takes two inputs: the cost of the meal and the tax. It should return the size of the tip.

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; tip : Number Number -> Number; given a price and a tip percentage, return the tip amount

Example:; (tip 50 20) => 10

(define (tip total percent)…function body…)

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

Problem Statement

Write a function ‘blue-rect’, which takes width and height as input, and outputs a solid blue rectangle of the appropriate size.

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Contract+Purpose Statement; blue-rect : Number Number -> Image; draws a blue rectangle of the correct size

Example:(blue-rect 10 40) =>

(define (blue-rect x y)…function body…)

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

Problem Statement

Write a function ‘3digits’ that takes a number as input and returns ‘true’ if the input is more than 100 and less than 999.

$400 - Step 5$400 - Step 5

Contract+Purpose Statement; 3digits : Number -> Boolean; returns true if the input has 3 digits

Example:; (3digits 173) => true

(define (3digits 543)…function body…)