COMP 210 Homework #1
Spring 2003
Due Wed., Jan. 22, 2003 at the start
of class
Before you start the homework, you should remind yourself of our General Advice,
Advice on Homeworks, and Grading Guidelines. All are available from the class
web
site ( http://www.owlnet.rice.edu/~comp210)
.
You should turn in one copy of the homework
for your team (not one per person) .
Clearly print the names of both team members on the homework. Staple
together all of
the pages (before you get to class).
Read Sections 1 through 4 of the book (if available).
- ( 5point) Put the following expressions into Scheme s prefix notation. Type
the
results into Dr. Scheme s interactions window and see if you get the expected
results.
- 17
- 17 * 12
- 170 * 5 * 12
- 5 * 6 * 7 * 8
- ( 20 points) Hand evaluate the following Scheme expressions. After you are
done,
type them into the interactions window in Dr. Scheme to confirm your results.
- (- (* 3 5) 20)
- (* pi (* 10 10))
- (+ 73 false)
- (/ 12 0)
- ( 15 points) Go to the definitions window and type in the three
functions from Lecture 1:
owes, dough-area,
and pizza-topping-area. Click
the execute button. Go to the
interactions window, and invoke each function on two different arguments.
Hand in your code, your tests and the results.
- ( 10 points) Write a function Rectangle-area
that consumes a height and a width, and
produces the area of a rectangle of that size. Be sure to write down the contract
and
purpose. Test your program on several inputs. Hand evaluate the expression
(Rectangle-area 10 15)
(Here is
a sample hand evaluation, to give you an idea of what we want.)
50 points total
Drop-off homework here: ftp://comp210@www.exciton.cs.rice.edu/comp210/dropoff/hw01