Due on the web by 4pm, Tuesday,
Feb. 2, 1999. This homework will be graded out of 10. Two points of
this will be on how well your code is documented. Roughly you should
follow the documentation conventions of the cRecorder.java file
below. In addition any algorithms which are obscure should be
clarified with comments. Also state pre-conditions and post-conditions for
each method you write. Now for the homework. Read to page 48 in Bailey and
Chapter 9,10 in D&D; Then make a subdirectory of your homepage directory
called hw1 (make sure you have the case right). Put your source
code for this homework here.
Write an applet named Face.java that when compiled and run draws a
face. Be creative. However, you need to use at least one polygon, one
oval, one arc, one line, and one rectangle. You also need to use at least
three colors and have a title printed at the top in something other than
the default font. See below for an example face.
Download the file cRecorder.java This
class provides some methods to record a list of objects. Write a method
toString for this cRecorder class (thus overriding the toString method
inherited from Object) that returns a string which lists on separate lines
the items stored in an instance of cRecorder. You should use StringsBuffer's
to do this. Then write an applet ButtonRecorder.java which uses a
BorderLayout to draw a label, three buttons, and a textarea. See the
applet below to see how it should look. The applet should record
left/right button presses (using the string "left" for a left press and
"right" for a right press) into a cRecorder instance. When the middle
button is pressed it should output a history of the left/right buttons
pressed to the textarea. It should then clear the contents of the
cRecorder instance. Please experiment with the applet below to see what I
mean.