title: Java program unintentionally requires pressing enter twice
body: <p>I'm making a simple simulation of a slot machine and after working on it for a while, I've gotten it to work for the most part. The only issue is when I ask the user to enter how much money they would like to bet, the program only proceeds when they press enter twice. I have no idea what's causing this and I feel like it's a really easy fix, so any help possible would be very highly appreciated!</p>
  
  <p>Here's the program:</p>
  
  <pre><code>import java.util.*;
  import java.text.DecimalFormat;
  
  public class SlotMachineSimulation
  {
     public static void main(String[] args)
     {
        Random randomN = new Random();
        DecimalFormat money = new DecimalFormat("$###,###,###,##0.00");
        Scanner kb = new Scanner(System.in);
  
        String fruit1 = "abcd";
        String fruit2 = "abcd";
        String fruit3 = "abcd";
        int slot1 = 0;
        int slot2 = 0;
        int slot3 = 0;
        double finalMoney = 0;
        double factor = 0;
        String aaa = "y";
  
        while(aaa.equalsIgnoreCase("y"))
        {
           System.out.print("Enter the amount you would like to bet: ");
           int bet = kb.nextInt();
           factor = 0;
           for (int i = 1; i &lt;= 3; i++)
           {
              final int maxRandom = 6;
              int slot = randomN.nextInt(maxRandom);
              int iteration = i;
              if(iteration == 1)
              {
                 slot1 = slot;
                 switch (slot)
                 {
                    case 0:
                       fruit1 = "cherries";
                    break;
                    case 1:
                       fruit1 = "oranges";
                    break;
                    case 2:
                       fruit1 = "plums";
                    break;
                    case 3:
                       fruit1 = "bells";
                    break;
                    case 4:
                       fruit1 = "melons";
                    break;
                    case 5:
                       fruit1 = "bars";
                    break;
                 }
              }
              else if(iteration == 2)
              {
                 slot2 = slot;
                 switch(slot)
                 {
                    case 0:
                       fruit2 = "cherries";
                    break;
                    case 1:
                       fruit2 = "oranges";
                    break;
                    case 2:
                       fruit2 = "plums";
                    break;
                    case 3:
                       fruit2 = "bells";
                    break;
                    case 4:
                       fruit2 = "melons";
                    break;
                    case 5:
                       fruit2 = "bars";
                    break;
                 }
              }
              else if(iteration == 3)
              {
                 slot3 = slot;
                 switch(slot)
                 {
                    case 0:
                       fruit3 = "cherries";
                    break;
                    case 1:
                       fruit3 = "oranges";
                    break;
                    case 2:
                       fruit3 = "plums";
                    break;
                    case 3:
                       fruit3 = "bells";
                    break;
                    case 4:
                       fruit3 = "melons";
                    break;
                    case 5:
                       fruit3 = "bars";
                    break;
                 }
                 System.out.println("-" + fruit1 + "--" + fruit2 + "--" + fruit3
                                   + "-");
                 if(slot1 == slot2 || slot1 == slot3 || slot2 == slot3)
                 {
                    if( slot1 == slot2 &amp;&amp; slot1 == slot3)
                    {
                       System.out.println("Great! Three Match!");
                       System.out.println("That triples your bet!");
                       factor = 3;
                    }
                    else
                    {
                       System.out.println("Great! Two Match!");
                       System.out.println("That doubles your bet!");
                       factor = 2;
                    }
                 }
                 else
                    System.out.println("Sorry, none match...");
                 double rawWinnings = factor*bet;
                 System.out.println("You win " + money.format(rawWinnings));
                 if(rawWinnings&gt;0)
                    finalMoney = finalMoney + rawWinnings;
                 else
                    finalMoney = finalMoney + bet;
                 System.out.print("Would you like to play again(enter y or n): ");  
              }
              aaa = kb.nextLine();
              if(aaa.equalsIgnoreCase("n"))
              {
                 System.out.println("You won a total of " + finalMoney);
                 System.exit(0);
              }
           }
        }
     }
  }
  </code></pre>