CS 135 Fall 2011
Becker, Goldberg, Kaplan, Tompkins, Vasiga
Assignment: 1
Due:
Tuesday, September 20, 2011 9:00 pm
Language level:
Beginning Student
Files to submit:
constants.rkt
,
functions.rkt
,
speed.rkt
,
grades.rkt
,
stars.rkt
Warmup exercises:
HtDP 2.4.1, 2.4.2, 2.4.3, and 2.4.4
Practice exercises:
HtDP 3.3.2, 3.3.3, and 3.3.4
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 and submission guide available on the course web page when preparing your
submissions. Your solutions for assignments in this course will be graded both on correctness and
on readability, meaning that, among other things, you should use constants and parameters with
meaningful names.
Note that for this assignment only, you do not need to include the design recipe in your solutions.
A well-written function deﬁnition is sufﬁcient.
If you have not yet received full marks for Assignment 0: You may submit this assignment
(and subsequent assignments), but it will be ignored unless you obtain full marks for Assign-
ment 0 before this assignment’s due date.
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, and 2.4.4.
Here are the assignment questions you need to submit.
1. Translate the following constant deﬁnitions into Scheme. Place your solutions in the ﬁle
constants.rkt
.
Note that for this question only, you will
not
be able to
Run
this
DrRacket ﬁle.
For example, if we asked you to translate the deﬁnition:
mean
=
x
1 +
x
2
2
you would submit:
(
deﬁne
mean
(
/
(
+
x1 x2
)
2
))
(a) An example from ﬁnance (
future value
):
FV
=
PV
·
(1 +
rate
)
n
CS 135 — Fall 2011
Assignment 1
1