Question: Exercise 2 (60 points): Write a program that helps a cashier make change. The program gets a dollar amount from the user and calculates and

 Exercise 2 (60 points): Write a program that helps a cashier

Exercise 2 (60 points): 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. The data entered by the user is in blue. Sample Output 1: Enter the amount: 11.92 Change due: 11 dollars 3 quarters 1 dimes 1 nickel 2 pennies Sample Output 2: Enter the amount : 4.14 Change due: 4 dollars 0 quarters 1 dimes O nickel 4 pennies Sample Output 3: Enter the amount: 64.99 Change due: 64 dollars 3 quarters 2 dimes 0 nickel 4 pennies Page 2 of 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!