Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
DAY 4
TEAM COMPETITION!!
Lesson Overview:
Students work in teams to solve a series of simple problems using Agenda
the Design Recipe. The goal is to test and reinforce everything (flex) Game and Review
they‟ve learned up to this point, and to have them rely on one
another.
Learning Objectives
Students will:
Learn to apply the Design Recipe to a variety of problems.
Product Outcomes
Students write many small functions.
Ritual
Students work in pairs, one coding while the other leads. Every ten minutes, we yell “switch!”
and they must do so.
Monitors are OFF unless otherwise noted or during mini-labs. The signal for a successful mini lab
is a monitor that is switched off.
Length: 90min
Materials and Equipment
PowerPoint Slide Deck
Computers w/DrScheme Preinstalled
Student notebooks or papers
Design Recipe Visual
Preparation
Write agenda on board, and summarize Types, functions, and everything else they should have
memorized.
Do Now: What are the steps of the Design Recipe? Use the Recipe to write a function that takes a
number and returns “true” if the number is bigger than 1000. Show ALL STEPS.
Vocabulary/Concepts (on board, but to be explained)
Current Language
Values Functions
Numbers +, -, *, /, expt, sqrt, number->string
Functions define
Strings string-append, string-length
Booleans , and, or, string=?
Image circle, rectange
1/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
Tip
I. State the Problem – DONE FOR YOU
You 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)
II. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
III. Contract+Purpose Statement
Every contract has three parts…
IV. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (tip 50 15) should return 7.5
V. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
2/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
Triple
I. State the Problem – DONE FOR YOU
Write a function „triple‟, which takes in a number as input and outputs a number three times its
size.
II. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
III. Contract+Purpose Statement
Every contract has three parts…
IV. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (triple 12) should return 36
V. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
3/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
Hello
I. State the Problem – DONE FOR YOU
Write a function „hello, which takes in a name as input and prints out “Hello, _____” for that
person, filling in their name.
II. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
III. Contract+Purpose Statement
Every contract has three parts…
IV. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (hello “Bill”) should “Hello, Bill”
V. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
4/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
circle30
I. State the Problem – DONE FOR YOU
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.
II. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
III. Contract+Purpose Statement
Every contract has three parts…
IV. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (circle30 “orange”) should draw an orange circle with radius 30
V. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
5/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
Blue-rect
VI. State the Problem – DONE FOR YOU
Write a function „blue-rect‟, which takes width and height as input, and outputs a solid blue
rectangle of the appropriate size.
VII. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
VIII. Contract+Purpose Statement
Every contract has three parts…
IX. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (blue-rect 20 50) should draw a blue rectangle that is 20 wide and 50 high
X. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
6/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
feet->inches
I. State the Problem – DONE FOR YOU
You‟re buying beautiful tile for your new bathroom, and you need to convert the measurements
from feet to inches. Write a function “feet- >inches” which takes a length (in feet) and returns a
length (in inches).
II. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
III. Contract+Purpose Statement
Every contract has three parts…
IV. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (feet->inches 3) should return 36
V. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
7/8
Northeastern University
Dept. of Computer Science
Q uic kT im e™ an d a
T IFF ( Un c om pr e s se d ) d e co m pr e ss o r
a re n ee d ed to s e e th is p ic tur e .
3digits
VI. State the Problem – DONE FOR YOU
100 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.
VII. Define the Data
What kind of data are you using? Numbers? Strings? Images? Write down examples of each.
VIII. Contract+Purpose Statement
Every contract has three parts…
IX. Give Examples
Write an example of your function in action. One of them is provided below, but you need to come
up with another one on your own.
; (3digits 9261) should return „false‟
X. Take Inventory
Write the function header, and make a list of every function and variable you‟ll need.
8/8