Mar. 21: I changed the assignment slightly, adding problem 10.3.5 (which isn't long) and changing problem 10.6.2 (which is long) to "extra credit". It's a good exercise, however: even if you don't get all of it working, I encourage you to start on it and turn in as much as you can do.
gas-cost
function)cylinder-volume
). Hint: the volume
of a cylinder is its height times the area of each end.cylinder-area
). Hint: you'll need to
compute some other values along the way. If such a value would be useful
on its own, write an auxiliary function for it.net-pay
). Note: this wasn't in the
originally-uploaded version of Chapter 10; it's in the version uploaded
on Mar. 21.build-house
; please don't
write this as one big function!)airline-profit
;
don't even think about writing this as one enormous function!)All the problems are programming problems, requiring one or more functions that call one another (so they have to be in the same Definitions pane). You can do each problem in a separate Definitions pane, or all four in one.
Also turn in a log of how many errors of different kinds you encountered in the assignment, with brief comments describing each one ("mismatched parentheses" is self-explanatory, but more complex errors might need more description). Note that "errors" means not only error messages from DrScheme, but also wrong answers. You may do this using the PSP forms, or simply by keeping track in a text file or on paper and turning it in.
For every function you write, be sure to follow the design recipe.
Be sure to choose meaningful names for functions and parameters, and watch for opportunities to re-use functions you (or the textbook) have already written.
This assignment is to be done in pairs, using the ideas from the "kindergarten" article. Choose a partner ASAP and schedule time to work together on the assignment. When you're finished, turn in one assignment with both names on it. You'll have a different partner for homework 6, so if you don't get along with this partner, remember it's only for a week.
Error log: /25
(I'm not grading on how many or how few errors you encountered,
only on whether you recorded them correctly.)
I sha'n't actually grade all the programming problems; consider the others "practice". For each function I grade, see the table below.
The table below has columns for each step in the design recipe. You won't turn in a separate skeleton and definition, but rather write a skeleton and then add stuff to turn it into a definition. However, if you don't get the definition working, you'll still get partial credit for a correct skeleton.
Contract | Examples | Skeleton | Definition | Test results |
---|---|---|---|---|
/5 | /5 | /5 | /10 | /5 |
Following directions | /10 |
Writing contracts from word problems | /10 |
Choosing examples | /10 |
Choosing names | /10 |
Coding | /10 |
Code re-use and function composition | /10 |