The objectives of this assignment are to:
- Exhibit Excellent Programming
style, and
- Use Expressions
20 points
Your nephew, Harold (they/them), is starting a job at a local coffee show
and needs your help in computing tax and giving change. Harold will provide
you with the total of the purchase, and the amount of money the customer gives
them.
Using a tax rate of 6%, calculate and display the total with tax, the total amount to be returned, and the number of one dollar bills,
quarters, nickels, and pennies to be returned.
Your assignment is to
- Request that Harold enter the cost of the purchase
- Tell Harold how much the tax is (Note: your program is to use a constant for
the tax rate)
- Tell Harold the total of how much the customer owes
- Request that the Harold enter the amount of money the customer gives them
- Report the total that Harold needs to give the customer
- Tell Harold how many dollar bills, quarters, dimes, nickels, and pennies to
hand the customer
- You may NOT use IFs or any other conditional. You MUST
use mathematics!
- Change the decimal number into the number of pennies owed
12.55 or twelve dollars and 55 cents is equivalent to 1,255 pennies
Multiply the amount (e.g., 12.55) by 100 to get the equivalent
number of pennies in integer format
- Compute the number of dollar bills by doing integer division ( divide by 100)
- Calculate what is left
What is 1255 mod 100?
- Using the remainder calculate the number of quarters
- Continue this process to determine the number of dimes, nickels and pennies
Additionally,
- You must use a constant for the .06 tax rate.
- Create nicely formatted output .
- As always, your program should be structured and follow the
grading criteria for the course.
- Place your code (.cpp) in the D2L dropbox named Assign2.
Put a text copy of your output in the D2L drop box. In the description area,
provide any notes to me that you would like.
- Copy a sample run of your program into a .txt file and upload that as well.
- Hand in a printout of only your code
Sample Run:
Enter the total of the purchase => 1.95
The tax on $1.95 is: 0.117
The customer owes: $ 2.067
Enter the amount the customer gave you => 5.00
Give the customer $2.933 in these denominations:
2 dollar bills
3 quarters
1 dimes
1 nickels
3 pennies
A better Sample Run:
Enter the total of the purchase => 1.95
The tax on $1.95 is: 0.117
The customer owes: $ 2.07
Enter the amount the customer gave you => 5.00
Give the customer $2.93 in these denominations:
2 dollar bills
3 quarters
1 dimes
1 nickels
3 pennies