title: Bar chart with asterisks
body: <p>The program is supposed to take in all five numbers from the user and then print all five sets of asterisks at the same time. I don't understand how to code it so that it prints the asterisks at the same time. </p>
  
  <p>This is what my program is printing so far: </p>
  
  <p><img src="https://i.stack.imgur.com/v5bvp.png" alt="This is what my program is printing so far"></p>
  
  <pre><code>import java.util.Scanner;
  public class BarChart 
  {
  
      public static void main(String[] args) 
      {
          int i, j, n = 0; 
  
          Scanner input = new Scanner (System.in);
  
          System.out.print("Enter a number between 1 and 30 ");
          for (i = 0; i &lt; 5; i++) {   
              n = input.nextInt();
              if (n &gt; 30 || n &lt; 1) {  
                  System.out.println("Number out of limits, enter a number between 1 and 30 ");
                  n = input.nextInt();
              }
              for (j = 0; j&lt; n; j++)
                  System.out.print("*");
              System.out.println();
          }
          System.out.println(); 
      }
  }
  </code></pre>
  
  <p>Also, I cannot use Array's as we haven't gone over that chapter yet.</p>
  
  <p>This is what I have now and it's working.</p>
  
  <pre><code>import java.util.Scanner;
  public class BarChart 
  {
  
      public static void main(String[] args) 
      {
          Scanner input = new Scanner(System.in);
          int n1 = 0;
          int n2 = 0;
          int n3 = 0;
          int n4 = 0;
          int n5 = 0;
          int i = 1;
  
          System.out.println("Enter a number between 1 and 30 ");
          n1 = input.nextInt();
  
          System.out.println("Enter a number between 1 and 30 ");
          n2 = input.nextInt();
  
          System.out.println("Enter a number between 1 and 30 ");
          n3 = input.nextInt();
  
          System.out.println("Enter a number between 1 and 30 ");
          n4 = input.nextInt();
  
          System.out.println("Enter a number between 1 and 30 ");
          n5 = input.nextInt();
  
          for(i = 1; i &lt;= n1; i++) {
              System.out.print("*");
          }
          System.out.println();
  
          for(i = 1; i &lt;= n2; i++) {
              System.out.print("*");
          }
          System.out.println();
  
          for(i = 1; i &lt;= n3; i++) {
              System.out.print("*");
          }
          System.out.println();
  
          for(i = 1; i &lt;= n4; i++) {
              System.out.print("*");
          }
          System.out.println();
  
          for(i = 1; i &lt;= n5; i++) {
              System.out.print("*");
          }
          System.out.println(); 
  
          input.close();
      }
  }
  </code></pre>