CpSc 146 Assignment 2
Fall 2022

The objectives of this assignment are to:
  1. Exhibit Excellent Programming style, and
  2. 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

  1. Request that Harold enter the cost of the purchase
  2. Tell Harold how much the tax is (Note: your program is to use a constant for the tax rate)
  3. Tell Harold the total of how much the customer owes
  4. Request that the Harold enter the amount of money the customer gives them
  5. Report the total that Harold needs to give the customer
  6. 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,
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