You may work in pairs for these in-class exercises.
Drawing arcs in Java is similar to drawing ovals- an arc is simply a section of an oval. Download and run the following file, which draws a rainbow using filled-in arcs: DrawRainbow.java
Complete at least one of the following exercises:
drawLine
. One technique is to use a loop that
increases the line length after drawing every second
line. The direction in which to draw the next line should
follow a distinct pattern, such as down, left, up, right.
drawArc
to draw one
semicircle at a time. Each successive semicircle should have
a larger radius (as specified by the bounding rectangle's
width) and should continue drawing where the previous
semicircle finished.
It may be helpful for you to sketch out your design on paper before trying to program it.
Upload your program files to the VikingWeb.
Based on material from Deitel & Deitel, Java How to Program, 6e.