Question: in java Use opening documentation, document the body of the code and add your name as the last output. Create a program that computes and
in java
Use opening documentation, document the body of the code and add your name as the last output. Create a program that computes and then outputs the change that will be dispensed similar to what happens at the WAWA or a grocery store. The user will enter an amount for change like 99 for 99 cents. Ex: How much change do you want to make? Use final constant for value of a quarter, dime, nickel and penny. Starting with the largest value coin which is quarters, you will determine the amount of quarters to dispense. Next, the new balance of change needs to be updated accounting for what has been dispensed in quarters. Again, you check to see how many dimes will be dispensed and update the balance of the change that still needs to be calculated. Continue on with process for nickels and pennies until the proper change has been calculated. Output message will contain the change being dispensed along with the number of quarters, dimes, nickels, and pennies. Sample output: You have entered 99 cents for change which is 3 quarters, 2 dimes, 0 nickels, 4 pennies
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
