Can anybody help me with this? As part of a worksheet, I have to draw a bullseye using graphics. I can draw the bullseye perfectly but its just full of repetitive code and my heads been puzzled trying to put it all into a loop. Heres the code ( remember im only learning so dont be too harsh ):
import graphics.*; public class Q2 { public static void main(String[] args) { Window w = new Window(500,500); Circle c = new Circle(250, 250, 200); Circle c2 = new Circle(250, 250, 180); w.draw(c); w.draw(c2); w.fill(c); w.clear(c2); Circle d = new Circle(250, 250, 160); Circle d2 = new Circle(250, 250, 140); w.draw(d); w.draw(d2); w.fill(d); w.clear(d2); Circle e = new Circle(250, 250, 120); Circle e2 = new Circle(250, 250, 100); w.draw(e); w.draw(e2); w.fill(e); w.clear(e2); Circle f = new Circle(250, 250, 80); Circle f2 = new Circle(250, 250, 60); w.draw(f); w.draw(f2); w.fill(f); w.clear(f2); Circle g = new Circle(250, 250, 40); Circle g2 = new Circle(250, 250, 20); w.draw(g); w.draw(g2); w.fill(g); w.clear(g2); } }
basically, you have to draw a larger ring, then a smaller one, fill the large one & finally clear the small one. It HAS to be in that order. Thats why im so confused as to how to put all this into a loop. Any help is greatly appreciated, thanks