Skip to content

Solirius/vending-machine-test-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vending Machine Test

Design a Vending Machine which:

  • Accepts coin values 1, 5, 10, 20, 50
  • Allows the user to select products e.g. Coke(27), Pepsi(35), Dr Pepper(45)
  • Returns the selected product and remaining change if any
  • Returns change in the lowest number of coins possible

Complete the implementation of the ProductVendingMachine so that it passes the tests included in the codebase. Feel free to add more tests if desired.

public class ProductVendingMachine {

    public void addStock(Map<Product, Integer> stock) {

    }

    public PurchaseTransaction selectProduct(Product product) {
        return null;
    }

    public CompletedTransaction completeTransaction(PurchaseTransaction transaction) {
        return null;
    }

}

Running the application

./gradlew test

Topics for further discussion

  • What problems does concurrency add to this system?
  • What problems would need to be solved in a distributed system?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages