Hi Everyone,

My name is EFE, I am new on this website and also need to JAVA. I need a quick help to resolve this please....

We have a vending machine that accepts the following amounts of monastics (coins and bills):

20.00 10.00 5.00 2.00 1.00 0.50 0.20 0.10

These monics, when entering the machine can be stored in a drawer or in a hopper depending on its value.

There are hoppers of the following amounts:

2.00 0.50 0.10

This means that a 0.20 coin will always go to the drawer, and a 2 coin will always go to your hopper

To make returns, the machine can only use the coins that are in the hoppers.

In a database, the number of coins of each type that is available in each hopper is recorded in real time.

When a purchase is going to be made, the user inserts money into the machine until the amount entered is equal to or greater than that of the purchase. At that time, the machine sells the product and returns the remaining money.

For example, if we are going to make a purchase of a 3.50 product, and we put a 10 bill, the machine will return 3 coins of 2.00 and one of 0.50

When a purchase is being made, before reaching the purchase amount, the user has the possibility to cancel the purchase, so the machine will return the amount entered through the hoppers.

For example, in a purchase of a 3.50 product, and a 2 and a 1 coin is inserted and you press cancel, the machine will return 1 coin of 2.00 and two of 0.50

It has been detected that there are times when the machine cannot return the excess amount of the purchase or the amount introduced in a cancellation due to the lack of coins of some kind in the hoppers, which produces an incidence since the user loses that money .