CS 135 Fall 2008
Byron Weber Becker, Ian Goldberg, Brad Lushman, Daniel Roche, Troy Vasiga
Assignment 1
Due Wednesday, September 17, 10:30am
Files to submit:
temp.ss
,
simple-plot.ss
,
waves.ss
,
grades.ss
For this and all subsequent assignments the solutions you submit must be entirely your own work. Do
not look up either full or partial solutions on the Internet or in printed sources. Please read the course
Web page for more information on assignment policies and how to submit your work. Make sure to
follow the style guide (available on the Web page or in the printed presentation handouts package)
when preparing your submissions.
Language level
: Beginning Student.
Each assignment will start with a list of warmup exercises. You don’t need to submit these, but we
strongly advise you to do them to practice concepts discussed in lectures before doing the assignment.
This week’s warmup exercises are HtDP exercises 2.4.1, 2.4.2, 2.4.3, 2.4.4, 3.3.2, 3.3.3, 3.3.4.
Here are the assignment questions you need to submit. Questions 2 and through 3 require the
graphing
teachpack, which you can Add from the Language menu in DrScheme. You will need
read the documentation which is available at:
http://docs.plt-scheme.org/teachpack/graphing.html
.
Your submissions should not contain any images (though your code will produce images when it
is run).
1. Do exercise 2.2.1 from the textbook, “How To Design Programs” (HtDP). To convert a Fahren-
heit temperature to Celsius, subtract
32
and multiply by
5
/
9
. The third part of the exercise,
involving files, is optional. Then do exercise 3.3.6. Place your Scheme functions in the file
temp.ss
.
2. Write the function
tenth-sq
which consumes a numeric value
x
and produces
1
10
x
2
. Using
the
graphing.ss
teachpack to graph this function using the colour blue, and also graph the
line
y
=
x
in red on the same image. Place this solution in
simple-plot.ss
.
3. Write various functions to produce the following image using the
graphing.ss
teachpack.
(Note: the colours, at the maximum points from left-to-right are red, blue, black and orange).
Place your solution in the file
waves.ss
.
CS 135 – Fall 2008
Assignment 1
1