Vending Machine Task - Java

Hi, Happy Weekends. Most boring thing is every time you've been asked same questions or you've been requested to do same tasks in different ways. I faced a lot.

In IT field, It's happens for everyone at least one time. Don't be sad, It's a good practice and helpful. We can also prove our self to do same works in different ways, It's a kind of practice. It's a kind of strategy.

In earlier times, Most of times in interview, I getting the calculator tasks in Android. Yeah, I do successfully in each time.

Here I come to explain the Vending Machine Task in Java. I've asked for this task for three times in a row now, each time differently.

What is Vending Machine?
A vending machine is a machine that dispenses items such as snacks, beverages, alcohol, cigarettes, lottery tickets to customers automatically, after the customer inserts currency or credit into the machine.

How it's works?
Vending machine is having a different product items with different denominations. After you insert the coins into machine, you can select the product. Once you're product has been successfully paid. Product will be dispensed.

Insert Coins -> Select Product -> If selected product has exact amount you paid, you're product dispensed.

If selected product has insufficient amount you paid -> Machine ask you for paid remaining money.

If select product has successfully paid -> If remaining amount there, Coins will be dispensed.

Eject the coins, when you don't need to purchase.

You can see the Complete Code in Github. If I missed anything, kindly comment here. 

Comments

Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java

Print the large string values in android log cat.