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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started