Question: Minimum Change Problem using Dynamic Programming (JAVA) Create a program that calculates the minimum number of coins to give back as change using dynamic programming.
Minimum Change Problem using Dynamic Programming (JAVA)
Create a program that calculates the minimum number of coins to give back as change using dynamic programming.
What to do:
Make a class to hold JUnit tests with at least four test cases for the method described below
o One test case should expect an Exception when an empty array of coins is sent in as a parameter
Make a class to hold a method that has two parameters: an array of coins for a coin system (for example 1, 5, 10, 25 for the smaller, commonly- used coins in US currency) and an amount for which to make change. The method should return a list of the coins that add up to the amount. For example, for the US coin system and an amount of 42, the method would return a list including 25, 10, 5, 1, 1.
o The method should throw an exception if the array of coins sent in as a parameter is empty.
o The method must use dynamic programming.
There should be no main method in your code. Execution should be triggered only by the JUnit test cases.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
