CS 112b
Spring 1999
Ileana Streinu

Midterm Exam
Part 2

Thursday, March 24, 1999 2:30 hours

Getting organized

Some advice on how to proceed

Problem 1 (50 points)

The applet has two buttons and responds to mouse clicks. The buttons are labeled Circle and Fill.

If the last button pressed on was Circle, the user can draw an empty circle by click-and-drag. When the user presses the Fill button, the last circle that was drawn on the screen is now drawn as a filled circle.Then the applet will not respond to mouse clicks for drawing circles until the Circle button is pressed again. In the beginning, the applet behaves as if the Circle button has been pressed.

The applet draws only one circle at a time. It does not remember what the user did in the past. Each time the user draws a new circle, the one that was there before will disappear. Each time the circle button is pressed, the old circle disappears from the screen.

The circle drawing is done by click and drag. The user clicks on a point on the screen, then drags the mouse towards the bottom right part of the screen and finally releases the mouse. A circle is drawn at all these events.

The myApplet.java template.

Extra features to be added

Problem 2 (50 points)

For this applet, the user clicks and drags with the mouse to draw circles, as before. However, at any time all the circles are redrawn, not just the last one.

Extra feature

(if you finished already, add this extra feature for a bit of extra credit)

The circles are drawn with alternating colors: the first one is black, the second is red, then a next one is black again, then a red one follows, etc.
Last modified March 24, 1999.

Ileana Streinu