|
If you want to make the left edge of the leftmost circle the same distance from the edge of the drawing as the right edge of the rightmost circle, what do you want to do (in general)? A good answer might be:Shift all the circles a little bit to the right. | |
Shifting CirclesThe left edge of the leftmost circle is 0 pixels from the left edge. The right edge of the rightmost circle is 30 - 2*radius = 30 - 20 = 10 pixels from the edge. If every circle was shifted over five pixels, the drawing would be fixed. This can be done, by adding yet more arithmetic to the applet:
Here is what it outputs: The arithmetic used in drawing these circles is getting somewhat messy. It is not, for example, very clear what the statement
does, even after it has been explained. | |
QUESTION 17:What general technique could be used to make the program more easily understood? (This is a thought question that may take some time to answer. Hint: what type of language is Java?) Click Here after you have answered the question |