next up previous
Next: Draw the snowperson American Up: Homework 4: Snowpeople! Previous: Make a new project

Make a snowperson

1.
Create a new method named paintSnowperson that takes the same parameters as paintBox. It should draw three ovals, stacked on top of each other like a snowperson. The height and width of the snowperson should fill the bounding box, as in the figure on the quiz.

2.
Remove the existing code from the body of paintBox and add code that invokes paintSnowperson, passing as arguments a bounding box that is the same height as the window but only one third the width, and centered.

3.
You can resize the graphics window by dragging the lower-right corner of the Frame. Each time you resize, Java clears the window and invokes paint again, which invokes paintBox, which makes your program redraw the snowperson according to the new window size.

As you resize the screen, the snowperson should always touch the top and bottom of the screen, and the three ovals should touch, and the proportion of the three ovals should stay the same.



Allen B. Downey
1999-02-22