Jen Q.

asked • 06/26/17

Need help writing a code in Java.

I am asked the following.
 
Write a program that determines change to be dispensed from a vending machine using the least number of coins. An item in the machine can cost between 25 cents to a dollar, in 5-cent increments (25, 30, 35, …, 90, 95, or 100), and the machine accepts only a single dollar bill to pay for the item. Example dialogues can include 
 
Enter price of item (from 25 cents to a dollar, in 5-cent increments): 45



You bought an item for 45 cents and gave me a dollar, so you change is:

2 quarters,

0 dime, and

1 nickel.
 
 
I am not proficient in writing codes in Java, so please help me understand through an in-depth guide?

1 Expert Answer

By:

Andy C. answered • 10/02/17

Tutor
4.9 (27)

Math/Physics Tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.