Grid using loops
<p>I'm making a program that creates a grid with a number of lines and columns specified by the user.
I want the output to look something like this:</p>

<p>Lines (2..10) ? 3</p>

<p>Columns (2..20)? 5</p>

<pre><code>   |   |   |   |

---+---+---+---+---

   |   |   |   |

---+---+---+---+---

   |   |   |   |
</code></pre>

<p>But my program does this instead:</p>

<p>Lines (2..10) ? 3</p>

<p>Columns (2..20)? 5</p>

<pre><code>   |   |   |   |

---+---+---+---+---

   |   |   |   |

---+---+---+---+---

   |   |   |   |

---+---+---+---+---
</code></pre>

<p>This is what the program looks like:</p>

<pre><code>String[] vertical = new String[columns-1];
String[] horizontal = new String[columns];

do
{
    for(i = 0; i &lt; vertical.length; ++i)
    {
        vertical[i] = ("   |");
        System.out.print(vertical[i]);
    }

    System.out.printf("%n");

    for(i = 1; i &lt; columns; ++i)
    {
        horizontal[0] = ("---");
        horizontal[i] = ("+---");
    }

    if(horizontal.length &gt; 0)
        System.out.print(horizontal[0]);

    for(int m = 1; m &lt; horizontal.length; ++m)
        System.out.print(horizontal[m]);

    System.out.printf("%n");
    ++j;
} while (j &lt;= lines - 1);
</code></pre>

<hr>

<p>I know that I need to remove an horizontal line, the problem is that I don't know how to. And sorry for the bad formatting.</p>
