title: How to print out an X using nested loops
body: <p>I have searched through to find a simple solution to this problem.</p>
  
  <p>I have a method called </p>
  
  <pre><code>printCross(int size,char display)
  </code></pre>
  
  <p>It accepts a size and prints an X with the char variable it receives of height and width of size.</p>
  
  <p>The calling method <code>printShape(int maxSize, char display)</code> accepts the maximum size of the shape and goes in a loop, sending multiples of 2 to the printCross method until it gets to the maximum. </p>
  
  <p>Here is my code but it is not giving me the desired outcome.</p>
  
  <pre><code>public static void drawShape(char display, int maxSize)
    {
      int currentSize = 2; //start at 2 and increase in multiples of 2 till maxSize
  
      while(currentSize&lt;=maxSize)
      {
        printCross(currentSize,display);
        currentSize = currentSize + 2;//increment by multiples of 2
      }
    }
  
  public static void printCross(int size, char display)
  {
  for (int row = 0; row&lt;size; row++)  
          {  
              for (int col=0; col&lt;size; col++)  
              {  
                  if (row == col)  
                    System.out.print(display);  
                  if (row == 1 &amp;&amp; col == 5)  
                    System.out.print(display);  
                  if (row == 2 &amp;&amp; col == 4)  
                   System.out.print(display);  
                  if ( row == 4 &amp;&amp; col == 2)  
                   System.out.print(display);  
                  if (row == 5 &amp;&amp; col == 1)  
                   System.out.print(display);  
                  else  
                    System.out.print(" ");   
  
              }
              System.out.println(); 
      }
  }
  </code></pre>
  
  <p>Is it because I hardcoded the figures into the loop? I did a lot of math but unfortunately it's only this way that I have been slightly close to achieving my desired output.</p>
  
  <pre><code>If the printCross() method received a size of 5 for instance, the output should be like this:
  x   x
   x x
    x
   x x
  x   x
  </code></pre>
  
  <p>Please I have spent weeks on this and seem to be going nowhere. Thanks</p>