Graphic Java

The student will create an interesting pattern using drawLine and for loops.
EXAMPLE: The student will create an applet like the one shown here. This activity provides the student a chance to make an interesting pattern using drawLine and a for loop.
x

ASSIGNMENT:
Here's some code to help you get started:

  public void drawWeb(Graphics g, int a, int b, int x, int y, int xinc, int yinc){
      for(int c=0; c < 11; c++){
        g.drawLine(a,b,x,y);
        b+=10*yinc;
        x+=10*xinc;
      }
  }

It's called like this:
    drawWeb(g, 10,110,10,10,1,-1);

The tricky part is what each parameter refers to:
  1. Graphics g: Graphics reference
  2. int a: x coordinate for start of line
  3. int b: y coordinate for start of line
  4. int x: x coordinate for end of line
  5. int y: y coordinate for end of line
  6. int xinc: 1 for incrementing and -1 for decrementing
  7. int yinc: 1 for incrementing and -1 for decrementing