Question: Write a Java program that directs a cashier to give correct change to a customer. The program has two inputs: the amount due and the

Write a Java program that directs a cashier to give correct change to a customer. The program has two inputs: the amount due and the amount received from the customer. Your program should compute the difference, then compute and display the number of dollars, quarters, dimes, nickels and pennies that the customer should receive in change. You may assume that the amount paid will always be greater than the amount due. A sample run of the program might look like this: How much was the total? 32.95 How much did the customer pay? 35.00 Change is: 2.05 That is 2 dollar(s), 0 quarter(s), 0 dime(s), 1 nickel(s) and 0 penny(s). Thank you for making change with me! The amounts should be read in as floating-point numbers, but the difference between them should be converted to an integer in order to calculate the change denominations, because this will involve the use of modular division. Note that this operation will result, for certain quantities, in a result that is inaccurate by one penny.

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!