title: Print loop output horizontally?
body: <p>Hey guys I have to write a program for class that asks me to produce a bar graph based on how many cars a salesperson sold for the month. An example is this:</p>
  
  <pre><code>Pam XXXX
  
  Leo XXXXXX
  </code></pre>
  
  <p>I'm almost there but not quite. As of right now I can get one X next to the salespersons name but any others are printed underneath on separate lines.</p>
  
  <pre><code>Pam X 
  
  X
  
  
  X
  </code></pre>
  
  <p>If you can help me get those other X's on the same line I would really appreciate it. Thank you for your input!</p>
  
  <pre><code>import java.util.Scanner;
  public class BarGraph
  {
      public static int Pam = 0;
      public static int Leo = 0;
      public static int Kim = 0;
      public static int Bob = 0;
  
      public static Scanner kb = new Scanner(System.in);
  
      public static void main(String args[])
      {
          System.out.println("Enter number of cars sold by Pam ");
          Pam = kb.nextInt();
          kb.nextLine();
          System.out.println("Enter number of cars sold by Leo ");
          Leo = kb.nextInt();
          kb.nextLine();
          System.out.println("Enter number of cars sold by Kim ");
          Kim = kb.nextInt();
          kb.nextLine();
          System.out.println("Enter number of cars sold by Bob ");
          Bob = kb.nextInt();
          kb.nextLine();
  
          System.out.print("Pam "); pamsCars();
          System.out.print("Leo "); leosCars();
          System.out.print("Kim "); kimsCars();
          System.out.print("Bob "); bobsCars();
      }
  
      public static void leosCars()
      {
          for(int i=0; i &lt; Leo; i++)
          {
              printX();
          }
      }
  
      public static void kimsCars()
      {
          for(int i=0; i &lt; Kim; i++)
          {
              printX();
          }
      }
  
      public static void pamsCars()
      {
          for(int i=0; i &lt; Pam; i++)
          {
              printX();
          }
      }
  
      public static void bobsCars()
      {
          for(int i=0; i &lt; Bob; i++)
          {
              printX();
          }
      }
  
      public static void printX()
      {
          System.out.println("X");
      }
  }
  </code></pre>