Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//Test File: import static org.junit.Assert.*; import org.junit.Test; import jav

ID: 3592449 • Letter: #

Question

//Test File:

import static org.junit.Assert.*;

import org.junit.Test;

import java.util.Arrays;

public class CoinChangeTest {

@Test

public void testCoinChange1() {

CoinChange c = new CoinChange();

int[] denomination = {1,5,10,25};

int value = 37;

int answer = 4;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

@Test

public void testCoinChange2() {

CoinChange c = new CoinChange();

int[] denomination = {1,6,10};

int value = 11;

int answer = 2;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

@Test

public void testCoinChange3() {

CoinChange c = new CoinChange();

int[] denomination = {1,6,10};

int value = 13;

int answer = 3;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

@Test

public void testCoinChange4() {

CoinChange c = new CoinChange();

int[] denomination = {1,6,10};

int value = 17;

int answer = 3;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

@Test

public void testCoinChange5() {

CoinChange c = new CoinChange();

int[] denomination = {1,9,15};

int value = 37;

int answer = 5;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

@Test

public void testCoinChange6() {

CoinChange c = new CoinChange();

int[] denomination = {1,9,15};

int value = 54;

int answer = 4;

assertEquals(c.NumberofCoins(denomination,value),answer);

}

}

coins are minted with denominations of 15.10.25cent or denomination = {16.10), or denomination-(19,15). An algorithm for making change using the smallest possible number of coins repeatedly returns the biggest coin smaller than the amount to be changed until it is zero. For example, 17 cents will result in the series 10 cents, 5 cents, 1 cent, and 1 cent Given a set of arbitrary denominations c=(c..cd), describe an algorithm that uses dynamic programming to compute the minimum number of coins required for making change. You may assume that c contains 1 cent. 1) T[i]= 1 + min, isk T[i-D. ] 2) Implement the algorithm described in 1) using Java language by completing the given method declaration. You must use dynamic programming implementation. public static int, numOfCoins(incoinsList, int, value){ /** Write your code here to find out minimum number of coins required to provide the change for a given value This method will have a coinsList array, which can be any set of coin values that should be used to test the code. You cannot hard code this array because the array value will be g runtime, and an int value which specifies the value for which we need to calculate the minimum number of coins to be changed. This method should return the number of coins iving at /*Test The Program via Command line or Terminal avac-cp junit-4.12.jar CoinChangeTest.java java -cpiunit-4 12.iarhamcrest-core-1.3.jar org junit runner.JunitCore CoinChangeTest

Explanation / Answer

public static int NumberofCoins(int denominations[],int value){ int Temp[] = new int[value + 1]; //For Dyanamic Storing Solutions Temp[0] = 0; for(int i=1; i