/***************************************************************** * Program 1: Vending Machine Change * Programmer: Insert your name here * * Due Date: * Class: COMP 110_01 Instructor: Tabitha Peck * * Pledge: I have neither given nor received unauthorized aid * on this program. (signature on file) * * Description: This program outputs the change for a vending maching. * * Input: one whole number from 1 to 99 * * Output: The change from the vending machine * ******************************************************************/ import java.util.*; public class VendingMachine { public static void main(String[] args) { int amount, original_amount, quarters, dimes, nickels, pennies; System.out.println("Enter a whole number from 1 to 99."); System.out.println("I will output a combination of coins"); System.out.println("that equals that amount of change."); Scanner keyboard = new Scanner(System.in); //read the amount in the variable amount amount = keyboard.nextInt(); original_amount = amount; quarters = amount/25; amount = amount%25; dimes = amount/10; amount = amount%10; nickels = amount/5; amount = amount%5; pennies = amount; System.out.println(original_amount + "cents in coins can be given as:"); System.out.println(quarters + " quarters"); System.out.println(dimes + " dimes"); System.out.println(nickels + " nickels and"); System.out.println(pennies + " pennies"); } }