Question
Writee a C++ program that prompts for a cash value and an amount of purchases made against that amount.The program should then determine the change
Writee a C++ program that prompts for a cash value and an amount of purchases made against that amount.The program should then determine the change using US paper and coin currency. Working with the following bills and coins:
Fifty Cents, Twenty-Five Cents, Ten Cents, Five Cents, One Cent
One Dollar Bill, Five Dollar Bill, Ten Dollar Bill, Twenty Dollar Bill
display how many of each would be needed to make the change.In order to receive full credit, you must use a loop in the algorithm that performs thecalculation.The program dialog would look like:
Enter a value:32.00
Enter an amount of purchases made against this amount:18.52
The remaining change is: 13.48
Twenty US Dollar Bills: 0
Ten US Dollar Bills: 1
Five US Dollar Bills: 0
One US Dollar Bills: 3
Fifty US Cents Coins: 0
Twenty-Five US Cents Coins: 1
Ten US Cents Coins: 2
Five US Cents Coins: 0
One US Cent Coins: 3
Continue(y/n)?n
HINT: You really should use integer arithmetic to ensure that your calculations, down to that very last penny, are exact and accurate.
HINT: The % (modulus operator) is very helpful in computing remainders but requires twointparameters.
Submission Guidelines
- Writeee a program which produces the same output as the examples above
- The remaining change is: {CHANGE}
- Twenty US Dollar Bills: {VALUE}
- Ten US Dollar Bills: {VALUE}
- Five US Dollar Bills: {VALUE}
- One US Dollar Bills: {VALUE}
- Fifty US Cents Coins: {VALUE}
- Twenty-Five US Cents Coins: {VALUE}
- Ten US Cents Coins: {VALUE}
- Five US Cents Coins: {VALUE}
- One US Cent Coins: {VALUE}
- Continue (y/n)? {USER INPUT}
- You are given a main.cpp file.
- You must implement the calculateChange() method through files you must supplement.
- All files must be compile with the given main without having to modify the main file itself.
- Currency output must output to proper precision.
- For example, 'The remaining change is: 1.200000' will result in deductions.
- must be in
- main.cpp
- my_change_calculator.h
- my_change_calculator.cpp
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