Skip to content

gerisztein/atm-es6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

atm-es6

TL;DR

To run locally just type:

$ npm i
$ npm run serve

Or access the live demo.

Description

This is an exercise that simulates an ATM (Cash Machine). It was written in Vanilla Javascript (ES6).

The rules are simple:

  • It should always deliver the lowest number of bills
  • It's possible to get the amount requested with available bills
  • The client balance is infinite
  • Amount of bills/money is infinite
  • Available bills $100, $50, $20 and $10

Examples

Entry: 30
Result: { 20: 1, 10: 1 }

Entry: 80
Result: { 50: 1, 20: 1, 10: 1 }

Entry: 280
Result: { 100: 2, 50:1 , 20: 1, 10: 1 }

Entry: 125
Result: throw NoteUnavailableException

Entry: -130
Result: throw InvalidArgumentException

Entry: NULL
Result: throw [EMPTY SET]

Installation

Clone the repository and then go to the folder

$ git clone git@github.com:gerisztein/atm-es6.git
$ cd atm-es6

Install all the dependencies

$ npm install

Serve it locally

$ npm run serve

Right after that, it'll open the browser.
Usually the URL is http://localhost:8080.

Live Demo

A working version of the project is also available here.

https://gerisztein.github.io/atm-es6

Tech Stack

License

MIT License © Lucas Gerisztein