Due date: See Oncourse Modules or Assignments
Revised 2013 Jan 31
whilestatement: Chapter 5.
forstatement: Chapter 6.
Design, write, and test two programs, each of which draws one hundred random circles. One program should use a
while statement; the other, a
The circles should be placed at random locations, with random diameters and colors. Each circle should use two random colors: one for the fill (interior), and one for the stroke (circumference).
Each circle must fit entirely within the drawing window; however, circles may overlap.
paintComponentmethod to draw on a panel, as in the Bullseye and Boxes examples (Lewis and Loftus, Listings 6.5–6.8).
fillArcto color the interior of the circle, and
drawArcto stroke the edge. See Lewis and Loftus, Figure 2.12. Remember that both of these methods describe the arc in terms of an enclosing rectangle. Fill before stroking — it looks better that way.
forstatement and the other uses a
Through Oncourse Assignments, turn in the source code files for both versions (
for) and two screenshots of the random circle drawings.
60 points total