2
public class graphic {
    public static final int L = 10;

    public static void main(String[] args) {
        face(g,(L/2)*2, 20);
    }

    public static void face (Graphics g, int x, int y){
        int e = (x+1)*10;
        int d = x*3; 
        int h = y+8+(x-1)*16;
        for (int z= 2; z<x; z++){
            g.drawString("__/", ((e-(x*8))+d*8)+((x-3)*8)-24-(32*(z-2)),(h-(x-1)*16)+ (z*16));
        }
    }
}

With this forloop, I want to produce one __/ on the first line then on the second line two and so on until the eight line where it will print eight total and stop. So far it only prints one __/ on each line. What do I need to change in my code so that it will print __/ on one line and then increase by one on then next?

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
blam97
  • 31
  • 1
  • 6

1 Answers1

1

You simply use a variable you draw, and update the variable in the for loop.

String str = "stuff";
For(){
Draw method you have
Str = str + "stuff";
}
Dak31
  • 82
  • 8
  • Please use code formatting for code and code snippets, structured documents like HTML/XML or input/output. To do that, select the text and click the `{}` button at the top of the message posting/editing form. – Andrew Thompson May 08 '16 at 05:51
  • Sorry was doing this on my phone for the first time, and was having issues :P – Dak31 May 08 '16 at 15:04