An open API service indexing awesome lists of open source software.

https://github.com/solirius/vending-machine-test-java


https://github.com/solirius/vending-machine-test-java

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# 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.

```java
public class ProductVendingMachine {

public void addStock(Map 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?