Homework Assignment 5
MCS-178: Introduction to Computer Science II
Max Hailperin, Fall 2000
Due: November 20th (at the beginning of class)
- Do exercise 13.31 on pages 479-480. In addition to the parts
(a)-(c) listed there, do the following part (d): The object contains
four normal images and an integer in the range 0 to 3. The four
images are all four rotations of the original, and the integer
specifies which one is currently active. The mutator just updates the
integer, as in parts (b) and (c). The selector retrieves one of the
four images, using the integer to select which.
- Do exercise 13.35 on page 483.
- Do exercise 14.14 on page 513. Note that one of the errata listed
on the textbook's web page is in this exercise; be sure to do the
corrected version.
- Do exercise 14.17 on page 514
Note: In this last problem, you needn't actually add the
classes; instead, you should describe the class hierarchy that would
result. Briefly explain why your new classes would be useful, by
indicating what commonality among their subclasses they capture that
is not shared by their entire superclass. Also, note that you will
need to first read and think about exercise 14.16 on page 513.