title: Having troubles w/ drawing hourglass with asterisks in Java. (nested loops) (user decides # of rows)
body: <p>as the title states, I'm having problems drawing this hourglass figure. The goal is to have the user choose the number of rows (has to be odd and positive) and then draw the hourglass with that info. The top and bottom row will have the same amount of asterisks as there are rows. </p>
  
  <p>Should look something like this: </p>
  
  <pre><code>*******
   *****
    ***
     *
    ***
   *****
  *******
  </code></pre>
  
  <p>Here is the code I have so far: </p>
  
  <pre><code>public static void main(String[] args) 
  {
      double nRows;
      Scanner console = new Scanner(System.in);
  
      System.out.print("Please enter an odd-number of output-lines (enter zero to exit the program): ");
      nRows = console.nextDouble();
  
  
      for(int row=1; row&lt;=nRows; row++ )
          {
              for(int column = 1; column&lt;=nRows-row; column++)
                  System.out.print(" ");
              for(int column = 1; column&lt;= row*2-1; column++)
                  System.out.print("*");
          System.out.println();
          }
      }
  </code></pre>
  
  <p>This prints the bottom triangle.
  The problem I'm having troubles with is finding out the equation to print the top half. I assume that once I figure out the code for the top half, I'll have to use if statements to tell it when to switch between the top half and the bottom half?</p>
  
  <p>Any help with this would be greatly appreciated.</p>
  
  <p>EDIT: updated the variables to be a little easier to read. </p>
  
  <p>As for what I've been told thus far, here is my understanding:</p>
  
  <pre><code>for( int row = nRows; row&gt;=1; row--)
     {
       for ( int column = 1; column&lt;=nRows-ir; column++)
               System.out.print(" ");
       for ( int column = 1; column&lt;=row*2-1; column++)
               System.out.print("*");
       System.out.println();
     }
  </code></pre>