next up previous
Next: Draw a very fine Up: Assignment 5: Moiré patterns Previous: Draw a better target

Iterate

1.
Add variables to paintTarget named smallest, biggest and skip. smallest will be the diameter of the smallest circle, biggest will be the diameter of the biggest, and skip will be the distance between the circles. To start, make them 100, 400 and 50, respectively.
2.
Add a variable named diameter and initialize it to smallest. Write a while loop that draws a circle with diameter diameter, increments diameter by skip, and continues until diameter is greater than biggest.

3.
Test your program with various values of smallest, biggest and skip.



Allen B. Downey
3/3/1998