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 •...




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.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here