/** Change-making class! * * @author * * Other notes/comments: */ import java.util.Arrays; public class Change { /** * the data member holding all of the coin _types_: coinTypeList */ private int[] coinTypeList; /** * printArray, a helper for printing 1d int arrays * @param A, the 1d int array to be printed */ public static void printArray( int[] A ) { // we use the helper function Arrays.toString: System.out.println( Arrays.toString( A ) ); } /** * constructor for a Change problem! * @param coinTypeList_input, the list of denominations * in our tests, the list will always contain a 1! */ public Change(int[] coinTypeList_input) { this.coinTypeList = coinTypeList_input; } /** * makeChange returns an ascending-SORTED version of the * SHORTEST list of coins that make change for the input amount * * To sort? Use Arrays.sort( L ) It changes L - this is OK. * See docs.oracle.com/javase/7/docs/api/java/util/Arrays.html * * @param amt, the input amount * @return the sorted version of the shortest-length list * of integers that make change for amt */ public int[] makeChange(int amt) { // TODO - implement makeChange return null; } /** * minCoins returns the smallest number of coins needed * to make change for the input amount * * @param amt, the input amount * @return an int, the smallest number of coins needed to * make change for amt using the denominations in * this.coinTypeList */ public int minCoins(int amt) { // TODO - implement minCoins return 0; } /** * main, for smaller tests... */ public static void main(String[] args) { /* int[] denominations = {1,5,10}; Change C = new Change( denominations ); // US System printArray( C.makeChange(29) ); printArray( C.minCoinsTable ); printArray( C.prevCoinTable ); */ } }