Question: ChangeMaker (10 pts). Write an application called Change Maker, that prompts the user for an integer value between 1 and 99, representing the change in

 ChangeMaker (10 pts). Write an application called Change Maker, that prompts

ChangeMaker (10 pts). Write an application called Change Maker, that prompts the user for an integer value between 1 and 99, representing the change in cents) to be dispensed from a vending machine. Use the Scanner class to read in the value. Then display the equivalent amount of change as the number of quarters, dimes, nickels, and pennies. In other words, ChangeMaker should dispense the smallest number of coins. Developing pseudocode for this assignment will help you sort out the calculations. (see hint below) Please test your code with the following 4 cases and provide output of each case. Example Output: Welcome to ChangeMaker. I will find a combination of coins that equals that amount of change you should receive. Change in cents 88 Case 1 Case 2 Case 3 51 17 Please enter an amount from 1 to 99: 92 92 cents in coins can be given as: 3 quarters 1 dimes 1 nickels and 2 pennies Case 4 4 Hint: Integer Division and the Modulus Operator Starting out with a value in cents (from the user), the task is to convert that number into the smallest number of coins - quarters, dimes, nickels and pennies. If we use the example above of 92 cents, the first step is to determine how many quarters can be given. Use integer division. The number of quarters = total Cents / 25. This will return a whole number representing quarters. 3 quarters to be exact. Now, how do you determine how many cents remaining? Remember, the remainder can be found by using the modulus operator (%). This will be the remaining cents. So in the example, the remaining cents = total Cents % 25 which is 17 cents. Now, go through the same mechanics for dimes. Divide the remaining 17 cents to get the number of dimes. Again, use modulus for the remainder of cents. Then divide the remaining cents to get the number of nickels. Use modulus for the remainder of cents. This remainder is the number of pennies. It can be very helpful to try these calculations by hand to verify

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!