Question: Show a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per
Show a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies.
Example Input | Output
A negative int | Invalid input. Must be 0 or positive
0 | No change
45 | 1 Quarter
| 2 Dimes
/*
* This program prints proper changes for an input in pennies.
*/
import java.util.Scanner;
public class CoinChange {
public static void main(String[] args) {
/* ADD your work here. */
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
