Question: Write a program that reads an integer from 1 - 9 9 that represents some amount of change to dispense. The program should calculate the
Write a program that reads an integer from that represents some amount of change to dispense. The program should calculate the minimum number of coins in terms of quarters, dimes, nickels, and pennies that adds up to the amount of change. Write a void function that takes as input:
An int passed by value that represents the amount of change to dispense
An int passed by reference that returns the number of quarters needed
An int passed by reference that returns the number of dimes needed
An int passed by reference that returns the number of nickels needed
An int passed by reference that returns the number of pennies needed
Pay special attention to the bolded items above. You must use reference parameters within a single function for the quarters, dimes, nickels, and pennies. The main function MUST use this void function to calculate the number of quarters, dimes, nickels, and pennies to dispense as change. Write test code in the main function that calls your function with at least two test cases and outputs how many of each coin is needed to add up to the amount of change.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
