title: Vending Machine Change Calculator
body: <p>I want to break down the entered integer into coins of different sizes: quarters (25), dimes (10), nickels (5) and pennies (1). But I can't figure out what to do for the nickels and pennies.</p>
  
  <p>For example, input of <code>87</code> should output:</p>
  
  <blockquote>
    <p>3 quarters, 1 dime, 0 nickels, 2 pennies</p>
  </blockquote>
  
  <p>But I get: </p>
  
  <blockquote>
    <p>3 quarters, 1 dime, 1 nickel, 1 penny.</p>
  </blockquote>
  
  <p>I want it to check if it is a valid entry, if not, I want it to tell the user to enter it again until it gets the valid entry.<br>
  Secondly, if it gives the valid entry, I want it to run the program again, and again, but once it gives an invalid entry, I want the program to ask the user to enter a valid entry.<br>
  I managed to get most of it done, but I have trouble figuring out how to make the user take another entry over and over again. My code just stops after the second run.<br>
  Please help.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>public class VendingMachineChangeCalculator {
      public static void main(String[] args) {    
          Scanner takeit = new Scanner(System.in);
          System.out.println("Enter a whole number from 1 to 99"
              + "\nI will find a combination of coins that equals"
              +"the amount of change ");
          int money = 0;
          System.out.println("Please enter number: ");
          money = takeit.nextInt();
  
      if(money&gt;0 &amp;&amp; money&lt;=99) {
          System.out.println("You have: ");
  
          int quarter, dime, nickel, penny;
  
          quarter = money/25;
          money = money %25;
  
          dime = money/10;
          money = money %10;
  
          nickel = money/5;
          money = money%5;
          penny = money;
  
          System.out.println(quarter + " quarters");
          System.out.println(dime + " dimes");
          System.out.println(nickel + " nickles");
          System.out.println(penny + " pennies");
  
          System.out.print("Good job, enter a new valid integer: ");
          money = takeit.nextInt();                       
  }
   else  {System.out.print("Invalid entry, please try again: ");
   money = takeit.nextInt();
   } 
      takeit.close();
      }
   }
  </code></pre>