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

Write a program that tells what coins to give out for any amount of change from

ID: 3633278 • Letter: W

Question

Write a program that tells what coins to give out for any amount of change from 1 cent to
99 cents. The program should always use the minimum number of coins.
Use coin denominations of 25 cents (quarters), 10 cents (dimes), 5 cents (nickels), and 1
cent (pennies). Do not use half-dollar coins.
Your program will use the following function without modification.
void compute_coin(int coin_value, int& number, int& amount_left);
//Precondition: 0 < coin_value < 100; 0 <= amount_left < 100.
//Postcondition: number has been set equal to the maximum number of coins of
//denomination coin_value cents that can be obtained from amount_left cents.
//amount_left has been decreased by the value of the coins, i.e.,
//decreased by number*coin_value.
For example, suppose the value of the variable amount_left is 86. Then, after this call
compute_coin(25, number, amount_left);
the value of number will be 3 and the value of amount_left will be 11 (because if you
take 3 quarters from 86 cents, that leaves 11 cents).
Hint: Use integer division and the % operator to implement this function.
Your program will use the following function without modification.
void print_coins(int quarters, int dimes, int nickels, int pennies);
// Precondition: quarters, dimes, nickels, and pennies
// contain the correct number of coins.
// Postcondition: A sentence specifying the proper change is sent
// to the console.
Include a loop that lets the user repeat this computation for new input values until the
user says he or she wants to end the program.


Example Output:
Enter the amount of change: 86
86 cents can be given as 3 quarters, 1 dime, 1 penny.
Would you like to run the program again (Y or N)? Y

Explanation / Answer

#include using namespace std; //Precondition: 0
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote