![]() |
![]() |
|
home—info—lectures—exams—hws—archive
Due Sep.07 (Mon)09 (Wed)
(hardcopy, and on WebCT).
Your name and the assignment-number
must be in a comment at the start of the file.
Update: In class Monday we'll talk about test-cases
(and, we'll emphasize not-repeating-code).
However, I encourage you to finish as much as you can by Monday's class.
Hw02 will still be due next week on Monday.
Also, if any test-cases don't pass, say as much in a comment at the start of
that problem.
Note that some of the reading questions originally included here have been deferred for a week or two, for those who are still awaiting their textbook.
The exercises below are from the (free, online) book How to Design Programs. In DrScheme, set your language to “Beginning Student”: Language > Choose Language… > How to Design Programs > Beginning Student.
Do not repeat any code; call an existing function instead. (For example, there should only be one function in your entire code which multiplies pi by a radius.) If you create the right helper-method for 3.3.3, then 3.3.4 will be pretty easy to implement.
At least two test cases required for each (at least one non-trivial). For inexact (floating-point) calculations, check-expect isn't quite what we want; instead use check-within with a delta of 0.0001 or so.
(rectangle 80 20 'solid 'blue) (circle 20 'solid 'red) (ellipse 80 20 'outline 'orange) (overlay (rectangle 80 20 'outline 'blue) (circle 20 'solid 'red)) ; Think of 'overlay' as being "addition for images" ; overlay with an offset: (overlay/xy (rectangle 80 20 'outline 'blue) 30 10 (circle 20 'solid 'red)) ; If you want to explore documentation: ; In drscheme, position the caret on a function-name ; like 'overlay/xy', and hit F1. |
See also scheme-resources—ITEC380 Scheme resources.
home—info—lectures—exams—hws—archive
©2009, Ian Barland, Radford University Last modified 2009.Sep.11 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |