title: How to determine the smallest number of coins given a number of cents
body: <p>Assuming there are 5 coin types available: dollars(100 cents), quarters(25 cents), dimes(10 cents), nickels(5 cents) and pennies(1 cent), write a Java program that reads a monetary amount in cents and prints the smallest possible number of coins equaling the amount.  For instance, if 289 is read, your program will print 10 coins: 2 dollars, 3 quarters, 1 dime, and 4 pennies.   Test your program with several different amounts including 100, 99, 1, 141, and 183.  Your output should include the total number of coins as well as the number of each denomination.</p>
  
  <pre><code>import java.util.Scanner;
  class Hw1 {
    public static void main(String [] args) {
      Scanner in = new Scanner(System.in);
  
      int amounts; //input variables
      int dollars, quarters, dimes, nickels, pennies; //output variables
  
      System.out.print("Enter an amount in cent:");
      amounts = in.nextInt();
  
      //steps for computing dollars, quarters, dimes, nickels, and
      //pennies go here
  
      System.out.println("number of coins = "+ (dollars+quarters+dimes+nickels+pennies));        
    }
  }
  </code></pre>
  
  <p>I tried this one time and it was not right.</p>
  
  <pre><code>import java.util.Scanner;
  class Hw1 {
    public static void main(String [] args) {
       Scanner in = new Scanner(System.in);
  
       int amounts; //input variables
       int dollars, quarters, dimes, nickels, pennies; //output variables
       double totalValue;
       int dollarsValue= 1.00;
       int quartesValue= 0.25;
       int dimesValue= 0.10;
       int nickelsValue= 0.05;
       int penniesValue= 0.01;
       System.out.print("Enter an amount in cent:");
       amounts = in.nextInt();
  
    //steps for computing dollars, quarters, dimes, nickels, and
    //pennies go here
  
       System.out.println("number of coins = "+
       (dollars+quarters+dimes+nickels+pennies));
  
       System.out.print("number of dollars");
       dollars= CONSOLE.netInt();
       System.out.print("number of quarters");
       quarters= CONSOLE.nextInt();
       System.out.print("number of dimes");
       dimes= CONSOLE.nextInt();
       System.out.print("number of nickels");
       nickels= CONSOLE.nextInt();
       System.out.print("number of pennies");
       pennies= CONSOLE.nextInt();
  
       numberCoins=dollars+quarters+dimes+nickels+pennies;
       totalValue=(dollars+quarters+dimes+nickels+pennies));
        //prinitng out values
         System.out.println("total number of coins" +number of coins);
  
  
  
    }
  }
  </code></pre>