Lecture 2 Objectives
At the end of today's class you should
KNOW:
- define can be used to create functions
- define can be used to name constants
- a function should be commented with a contract and a purpose
- programs are built by combining smaller computations into larger computations
BE ABLE TO:
- create a function that performs an arithmetic calculation on its inputs
- use DrRacket's stepper to determine how operations are evaluated
- write a contract and a purpose for a function
Sample Exam Question:
Define a function called tip that will add a 15% tip to a given number.
Write a contract and a purpose for your function. Then define a function
called share-with-tip that computes the share of the cost of a pizza,
including the cost of the tip (refer to your answer to yesterday's sample
exam question). Write a contract and purpose for share-with-tip.