Cash Dispenser
This library is a partial representation of a cash dispenser module (CDM) used in an automated teller machine (ATM).
The main usage of this library is to provide an optimal solution for the known 'coin change problem'.
Installation
Loading in a web browser
Loading in Node.js
var CashDispenser = ;
Usage
Create a new CashDispenser
object instance
var cashDispenser = ;
Add some cash units to the cash dispenser
cashDispenser;cashDispenser;cashDispenser;
Perform a denominate operation by supplying the amount value and the currency reference
Example 1
var result = cashDispenser; // -> {"values": [1, 1, 0], "smallerAmount": 0, "greaterAmount": 0}
Example 2
var result = cashDispenser; // -> {"values": [2, 0, 0], "smallerAmount": 0, "greaterAmount": 0}
Example 3
var result = cashDispenser; // -> {"values": [2, 0, 1], "smallerAmount": 0, "greaterAmount": 0}
Example 4
var result = cashDispenser; // -> {"values": [], "smallerAmount": 11000, "greaterAmount": 12000}
License
Copyright (c) 2017 Yannick Ebongue
Released under the MIT License (see LICENSE.txt)