Write a program that tells what coins to give out for any amountof change from 1
ID: 3613368 • Letter: W
Question
Write a program that tells what coins to give out for any amountof change from 1 cent to 99 cents. For example, if the amount is 86cents, the output would be something like the following:
86 cents can be given as 3 quarter(s) 1 dime(s) amd 1penny(pennies). Use coin denominations of 25 cents (quarters), 10cents (dimes) and 1 cent (pennies). Do not use nickel andhalf-dollar coins. Your program will use the following function(amoung others): void computeCoin(int coinValue, int& number,int& amountLeft); /* Preconditions: 0 < coinValue < 100;0 <= amountLeft < 100. Postconditions: number has been setequal to the maximum number of coins of dem=nomination conValuecents that can be obtained from amountLeft cents. AmountLeft hasbeen decreased by the value of the coins, that is, decreased bynumber*coinValue. For example, suppose the value of the variableamountLeft is 86. Then, after the following call, the value ofnumber will be 3 and the value of amountLeft will be 11 (because ifyou take three quarters from 86 cents, that leaves 11cents):computeCoins(25, number, amountLeft); Include a loop thatlets the user repeat this computation for new input values untillthe user says he or she wants to end the program. (Hint: Useinteger division and the % operator to implement this function.)p>
Note: The program must include ampledocumentation to explain its purpose.
Explanation / Answer
#include using namespace std; void giveChange(int change) { int temp = change; int qaurter = 0; int dime = 0; int pennie = 0; if(change99) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.