This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: string, this technique is called rubber-banding. Although this program may seem quite powerful (and indeed it allows you to draw any figure on the screen that can be drawn with lines), it is also simple to implement. The entire program requires fewer than 20 lines of code. 2. Random circles Write a GraphicsProgram that draws a set of ten circles with different sizes, positions, and colors. Each circle should have a randomly chosen color, a randomly chosen radius between 5 and 50 pixels, and a randomly chosen position on the canvas, subject to the condition that the entire circle must fit inside the canvas without extending past the edge. The following sample run shows one possible outcome: – 2 – Checkerboard On some runs of this program you might not see ten circles. Why?...
View Full Document
- Fall '08
- Randomness, Euclidean geometry, Line segment, Statistical randomness, mouse button