CSC 160 Fall 2013 - Homework 3 (100 points)
Assigned Sept 16 & 18, due MONDAY Sept 23
Assignments submitted on Moodle with time stamps during
class time (Mon or Wed 4:15-5:30pm) will be given a grade of ZERO.
Assigned M 9/16
Textbook Reading (to review today's class):
Read Chapter 2 of the textbook.
Required Exercise from the textbook in DrRacket:
Do 2.1.3*:
a) Store a picture in a variable.
b) Then define
another variable named two-copies whose value is two copies
of that picture, one beside the other, by using the previous variable.
c) Then define a third
variable named six-copies whose value is a six-pack of the
picture, 2 wide by 3 high, by using two-copies.
d) Then press Run. Type the name of the first variable
into the Interactions Pane and press Enter. Make sure you got the result
you expected. Repeat for the other 2 variables.
Required Exercises from the textbook on paper:
Do 2.4.2: Draw a box diagram to prove that
(rotate-cw calendar) is a legal expression. Assume that
calendar is already defined.
Do 2.4.3b: Draw a box diagram for each of the three
expressions in your solution to Exercise 2.1.3* to prove they are all legal
expressions.
Do 2.5.1*: Show the sequence of steps the Stepper would take in
evaluating the expression two-copies, assuming that the definitions from 2.1.3* are above it in the Definitions Pane.
Reminder: At each step (but the last), you need to underline the sub-expression that's about to
be replaced (i.e., the way Exercise 1.7.1 is done in the textbook).
Textbook Reading (to prepare for next class):
Study Chapters 1-2 for Wednesday's quiz.
Read Sections 3.1-3.4 of the textbook.
Assigned W 9/18
Textbook Reading (to review today's class):
Read Sections 3.1-3.4 of the textbook.
Required exercises from the textbook in DrRacket:
Do 3.3.3* on page 35 (with the specific instructions given here):
a) Define a variable named solid-green-box whose value is a solid
green rectangle. Use a width of 10 and a height of 20.
b) Define a variable named
outline-blue-box which is what it
sounds like. Use a width of 10 and a height of 20.
For parts c and d, use only the variable names. Do not use the pictures
of the rectangles or the expressions using the rectangle operation, or only half
credit will be given.
c) Write an
expression to put the solid box above the outline of a box.
d) Create a two by two checkerboard where the upper left and bottom right
corners have the solid box, and the upper right and lower left corners
have the outline of a box.
Do 3.4.4 on page 39:
Write the function
contracts for ellipse, circle, and
star-polygon only.
For each argument, include its data type then describe what that argument is
in parentheses. (Make sure this exercise is commented out, as discussed in
Sections 3.4.3-3.4.4 of the text.). Note: The contract for
triangle was given in class, so it is omitted from this
exercise.
Textbook Reading (to prepare for next class):
Read Sections 3.5-3.10 of the textbook.
Submitting your Assignment
You are required to submit all of the Stepper and Box Diagram exercises (e.g. 2.4.2, 2.4.3b, 2.5.1*) through Moodle or on paper in
class. Be sure to include your first and last name at the top of your
paper!
You are required to submit all of the DrRacket exercises (e.g. 2.1.3*, 3.3.3*, 3.4.4) in a single Definitions
Pane and a single Interactions Pane through Moodle. Points will be deducted for
completing the assignment with multiple Definitions and/or Interactions
Panes. Be sure to include your first and last name as a comment in the
first line of both the Defintions Pane and the Interactions Pane!
The file name for the Definitions Pane needs to
be "hw3[LastName]Def.rkt" where:
[LastName] is replaced with your last name.
For example, if I were submitting this
assignment, I would name the file
"hw3WittensteinDef.rkt".
Similarly, the file name for the Interactions Pane needs to be
"hw3[LastName]Int.rkt".
Please let me know if this is not clear or if you are unsure exactly
what filename to use. Part of your grade is using the correct filenames.
Note: All point values below are tentative and subject to change.
| GRADING |
| Question |
Point Value |
| 2.1.3* |
20 |
| 2.4.2 |
5 |
| 2.4.3b |
15 |
| 2.5.1* |
10 |
| 3.3.3* |
30 |
| 3.4.4 |
15 |
| Filenames |
5 |
| Total |
100 |
Last Modified: 9/18/13