Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real World Vending Machine Feature: Reduce Coin Supply! #36

Closed
1 task
nelsonic opened this issue Oct 28, 2018 · 3 comments
Closed
1 task

Real World Vending Machine Feature: Reduce Coin Supply! #36

nelsonic opened this issue Oct 28, 2018 · 3 comments

Comments

@nelsonic
Copy link
Member

As the company owning/operating vending machines - that sell delicious healthy vegan snacks,
we need to ensure that we give the correct change when people pay with cash
so that we don't accidentally short-change people and upset them.

We need to account for the "supply" of coins in the machine being reduced each time change is given and not attempt to give coins which are unavailable in the machine.

  • Create a function reduceCoinSupply that takes an array of "coins available" (coinsAvail) and an array of "coins given as change in the current transaction" (changeGiven) and returns an third array which is the coinsAvail minus the changeGiven.

Note: this is not "matrix math", it's simply removing elements from an array.

relates to #34 ... I don't want to simply switch to Tap from Tape without showing a valid use-case! 😉

@nelsonic
Copy link
Member Author

Failing Test:
reduceCoinSupply-failing-test-not-a-function

@nelsonic
Copy link
Member Author

Function exists but result is null:
image

@nelsonic
Copy link
Member Author

Passing:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant