From 9d53d8857eaa1c9405894a88ca75bc4657e42f35 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 05:31:48 -0600 Subject: Inital Commit --- Java/CorrectChange.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Java/CorrectChange.java (limited to 'Java/CorrectChange.java') diff --git a/Java/CorrectChange.java b/Java/CorrectChange.java new file mode 100644 index 0000000..ea163a6 --- /dev/null +++ b/Java/CorrectChange.java @@ -0,0 +1,25 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; + +class CorrectChange { + public static void main(String[] args) throws java.io.IOException { + int dollars, cents,quarters,dimes,nickels,pennies; + + BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); + dollars = Integer.parseInt(input.readLine()); + cents = dollars%100; + dollars = (dollars-cents)/100; + quarters = cents/25; + dimes = (cents%25)/10; + nickels = (cents%10)/5; + pennies = (cents%5)/1; + System.out.println("Your change is: " + dollars + " dollar(s), " + quarters + " quarters " + dimes + " dimes, " + nickels + " nickels, " + pennies + ", pennies"); + + + + + + } +} + +//By msglm; Licensed under the AGPL v3 -- cgit v1.2.3