Question
C++ C++ Write a program that helps a cashier make change. The program gets a dollar amount from the user and calculates and displays how
C++
C++ Write a program that helps a cashier make change. The program gets a dollar amount from the user and calculates and displays how to make the change using the smallest number of bills and coins possible. (The change should be made by first giving the maximum number of dollars, followed by the maximum number of quarters, then dimes, nickels, and finally pennies. i.e. Your answer should never have more than 3 quarters, 2 dimes, 1 nickel, or 4 pennies.) You may assume that only amounts greater than $0 will be entered. Hint: To avoid problems with the lack of precision that exists in floating-point values you may want to convert the amount entered by the user to pennies and use integer arithmetic. Sample output of a program that satisfies the requirements is shown below.
Sample One:
Enter the amount: 11.92 Change due:
11 dollars
3 quarters
1 dimes
1 nickel
2 pennies
Sample Two:
Enter the amount: 4.14 Change due:
4 dollars
0 quarters
1 dimes
0 nickel
4 pennies
Sample Three:
Enter the amount: 64.99 Change due:
64 dollars
3 quarters
2 dimes
0 nickel
4 pennies
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started