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

if the amount of change is $10.00 or less, I want you to tell me the number of d

ID: 3660453 • Letter: I

Question

if the amount of change is $10.00 or less, I want you to tell me the number of different ways you could have made change for that amount. For example, if my change was $0.25, you would give me a quarter, but tell me that there are 13 different ways you could have made change (or if my change was $0.50, you would give me a half-dollar and tell me that there are 50 ways you could have made change). Run your program to show the results for $10.00 -$5.00 - $4.00 - $3.00 - $2.00 - $1.00 - $050 - $0.25 - $0.10 .

Explanation / Answer

Here's the code. The one for $10.00 might take a few seconds to calculate. #include using namespace std; int denominations[] = {1,5,10,25,50,100,200}; int number_of_coins = 7; int count(int n, int m) { if (n == 0) { return 1; } if (n < 0) { return 0; } if (m < 0 && n >= 1) { return 0; } return count(n, m-1) + count(n - denominations[m], m); } int change(int n) { return count(n, number_of_coins - 1); } void print_results_for_amount(int n) { cout