title: Console bar graph using loop, without graphics JAVA
body: <p>Currently working on example from a book loop chapter. Basically, there are 4 car sellers and each should have input how many cars they sold. Below inputs, their names should be printed out and in same line number of cars they sold(from input), but not in numbers, using X or star *. x or star represents that number input.
  Here is my code so far. I am stuck on printing that X or star next to a name. It prints out next to wrong name. Any way using loops only without array?</p>
  
  <pre><code> import java.io.*;
   public class BarGraphCarSold {
  
  public static void main(String[] args)throws IOException {
      BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
  
      System.out.print("Enter no of cars Bob sold &gt;&gt; ");
      int bobSold = Integer.parseInt(buf.readLine());
      System.out.print("Enter no of cars Pam sold &gt;&gt; ");
      int pamSold = Integer.parseInt(buf.readLine());
      System.out.print("Enter no of cars John sold &gt;&gt; ");
      int johnSold = Integer.parseInt(buf.readLine());
      System.out.print("Enter no of cars Kim sold &gt;&gt; ");
      int kimSold = Integer.parseInt(buf.readLine());
      System.out.println();
      System.out.println("Car Sales for Month");
  
  
      System.out.print("Bob  \n");
      System.out.print("Pam  \n");
      System.out.print("John  \n");
      System.out.print("Kim  ");
  
      for(int i = 1; i&lt;=bobSold;i++){
          System.out.print("X");
       }  
     }
   }
  
  OUTPUT
  Enter no of cars Bob sold &gt;&gt; 5
  Enter no of cars Pam sold &gt;&gt; 7
  Enter no of cars John sold &gt;&gt; 4
  Enter no of cars Kim sold &gt;&gt; 6
  
  Car Sales for Month
  Bob  
  Pam  
  John  
  Kim  XXXXX
  </code></pre>