https://github.com/solirius/vending-machine-test-java
https://github.com/solirius/vending-machine-test-java
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/solirius/vending-machine-test-java
- Owner: Solirius
- License: mit
- Created: 2020-09-30T08:19:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-30T12:43:31.000Z (almost 6 years ago)
- Last Synced: 2025-03-06T03:14:12.565Z (over 1 year ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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?