For all the programming assignments, be sure to follow the design recipe. Write your function contract, examples, and function definition in the Definitions Window, save it to a file, and send me this file. Also test your program: since you've already included examples in the Definitions window, you should be able to hit the Execute button and see all the results (along with what you said they "should be"). Save the resulting Interactions window to a text file and send me this file too. 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.
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).
This assignment is to be done in pairs, just like previous homeworks (but with a different partner).
Develop a function in-box?
that
takes in two posns and two numbers. The first posn is a location on the
screen that you want to know about; the second is the top left corner of
a rectangle; the first number is the width of the rectangle; and the
second number is the height of the rectangle. Your function should tell
whether or not the first posn is inside the rectangle specified by the
other three parameters.
Hint: You'll need a lot of test cases, because there
are a lot of different reasons a posn might be outside the box: too far
right, too far left, too far up, too far down....
'Open
or 'Closed
bit, you may use either a string or a symbol, but tell me which!Do problem 2 in the supplementary exercises for chapter 7 (the one about cubes, prisms, and spheres).
Do problem 5 in
the supplementary exercises for chapter 7 (the one about three
different kinds of bank accounts). Where the problem says
'Error
, you may use either a string or a symbol (but tell
me which in your contract!)
Error log: /30
Function name | Contract | Examples | Definition | Test results |
---|---|---|---|---|
Following directions | /20 |
Writing contracts from word problems | /20 |
Choosing examples | /20 |
Choosing names | /20 |
Coding | /20 |
Code re-use and choice of auxiliaries | /20 |