title: Looping without creating new variables for Scanners?
body: <p>I am in need of help in an assessment I have to submit. our assessment is to make a mini cashier like a program that inputs ID and Quantity by however much I want to put. I'm still new.</p>
  
  <pre class="lang-java prettyprint-override"><code>int item, itm_id, ctr = 1, itm_qtty;
  Scanner input = new Scanner(System.in);
  
  System.out.print("Enter a Number of Items: ");
  item = input.nextInt();
  
  do {
      System.out.println("Item ID: ");
      itm_id = input.nextInt();
      System.out.println("Item Quantity: ");
      itm_qtty = input.nextInt();
      ctr++;
  } while (ctr &lt;= item);
  
  System.out.println("Item ID  |  Item Quantity");
  System.out.println(itm_id + "      |  " + itm_qtty);
  </code></pre>
  
  <p>What I want is to input the number of items I want to input > and I per se input 3 then a loop starts and makes me input the Item's ID and Quantity 3 times.</p>
  
  <p>but here's the catch in my system, every time another loop comes it overwrites the variable's previous input.</p>
  
  <p>Here's an example of the output that I want:
  Enter a Number of Items: <em>3</em></p>
  
  <pre><code>(1st loop)
  Item ID: *54628*
  Item Quantity: *2*
  (a loop occurs)
  
  (2nd loop)
  Item ID: *45462*
  Item Quantity: *1*
  (another loop occurs)
  
  (3rd loop)
  Item ID: *97832*
  Item Quantity: *3*
  </code></pre>
  
  <p>It would print out:</p>
  
  <pre><code>Item ID. . . . . . . .Item Quantity
  54628. . . . . . . . .2
  45462. . . . . . . . .1
  97832. . . . . . . . .3
  </code></pre>