/*
Describe the Program

This program inputs a number between 1 and 99 which represents an amount of change, and
calculates a combination of coins that represents that amount of change. For instance, if 55 is
entered, the result would be 2 quarters and one nickel.

Visualize the Dialog

This program will calculate a combination of coins equivalent to
an amount of change in the range of 1 to 99 cents
Please enter a whole number between 1 and 99
55
55 cents is equal to the following coins:
2 quarters
3 pennies
Thank You!

Develop Pseudocode

Output instructions to the user
Prompt for amount
Calculate quarters, dimes, nickels, and pennies
Output amount, quarters, dimes, nickels, and pennies

Refine and Conquer
*/
public class ChangeMaker {
public static void main(String[] args) {

  int amount, quarters, dimes, nickels, pennies, saveAmount;

  // Output instructions to the user
  System.out.println("This program will calculate the number of coins equivalent to");
  System.out.println("an amount of change between 1 and 99 cents");

  // Prompt for amount
  System.out.println("Enter a whole number between 1 and 99 inclusive:");
  amount = ConsoleInput.readLineInt();

  // Calculate quarters, dimes, nickels, and pennies
  // Store amount in saveAmount to preserve the value
  saveAmount = amount;
  // divide amount by 25 to get quarters
  quarters = amount/25;
  // update amount with the remainder of division by 25
  amount = amount%25;
  // divide (the new) amount by 10 to get dimes
  dimes = amount/10;
  // update amount with the remainder of division by 10
  amount = amount%10;
  // divide (the new) amount by 5 to get nickels
  nickels = amount/5;
  // the remainder of amount divided by 5 is the pennies
  pennies = amount%5;

  // Output amount, quarters, dimes, nickels, and pennies
  System.out.println(saveAmount + " cents in coins:");
  System.out.println(quarters + " quarters");
  System.out.println(dimes + " dimes");
  System.out.println(nickels + " nickels and");
  System.out.println(pennies + " pennies");

  // Output prompt to stop the program
  System.out.println("Thank You! Press <Enter> to stop the program");
  String inputLine;
  inputLine = ConsoleInput.readLine();
  }
}