title: How to draw a square in java?
body: <p><strong>Here is what I have to do:</strong></p>
  
  <blockquote>
    <p>You are to write a program that draws a square composed of # signs onto a grid. The user will enter the size (in the length of the sides), the x-coordinate, and the y-coordinate of the bottom-left corner
    of the square on the grid as command-line parameters to program, in that order. </p>
    
    <p>In other words, the three values will be stored in the String array args at the start of the program, as the values <code>args[0],
    args[1], and args[2]</code>. You can use the command <code>Integer.parseInt()</code> to convert the String into an int. Assume that the input parameters are valid ints. </p>
  </blockquote>
  
  <p><strong>For example</strong>, in the Interactions pane of DrJava:</p>
  
  <p>run Que s ti on 2 5 1 1
  means that we want to draw a square with side length 5 whose bottom-left corner is at position (1, 1).
  All distances in this question are in number of characters. By default, the program should print the
  square onto a 15x15 grid, but if the square wouldn’t fit, the grid has to be extended accordingly.</p>
  
  <p>I'm trying to build my program in three steps. </p>
  
  <ol>
  <li><p>write the code to display the axes properly. </p></li>
  <li><p>build a solution where the square always fits into the 15x15 grid. </p></li>
  <li><p>How to extend the program to make it work for larger squares or for squares that are too much shifted to fit into the 15x15 grid.</p></li>
  </ol>
  
  <p><strong>Here are my codes so far:</strong></p>
  
  <pre><code>import java.util.Scanner;
  
  public class drawS {
      public static void main(String[] args) {
          Scanner ask = new Scanner(System.in);
  
          int length = ask.nextInt();
          int i;
          int r = 15;
          int xmax = 15;
          int ymax = 15;
  
          drowLine(length);
  
          System.out.println();
  
          if (i == 0 &amp;&amp; j == 0) {
              System.out.print("+");
          }
          if (i == 0 &amp;&amp; j &lt;= ymax) {
              System.out.print("|");
          }
          if (j == ymax) {
              System.out.print("^");
          }
          for (int j = ymax; j &gt;= 0; j--) {
              for (int i = 0; i &lt;= xmax; i++) {
                  for (i = 0; i &lt; length - 2; i++) {
                      drowEmptyLine(length);
                      System.out.println();
                  }
                  drowLine(length);
              }
  
              public static void drowLine ( int n){
                  for (int i = 0; i &lt; n; i++) {
                      System.out.print("");
                  }
              }
  
              public static void drowEmptyLine ( int n){
                  System.out.print("");
                  for (int i = 0; i &lt; n - 2; i++) {
                      System.out.print("# ");
                  }
                  System.out.print('#');
              }
          }
      }
  }
  </code></pre>