Practice using ES6 classes
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Aug 15, 2017
index.html move script tag inside body element Feb 7, 2018
script.js starter code Sep 22, 2016

README.md

Make an ATM Class

$ git clone git@git.generalassemb.ly:ga-wdi-exercises/es6-classes-practice.git

For this exercise you will be creating an ATM class.

It will have the following properties...

  • type (e.g., "checking"), which should be determined by some input
  • money, which should start out as 0

It should have the following methods...

  • withdraw, which should decrease the amount of money by some input
  • deposit, which should increase the amount of money by some input
  • showBalance, which should print the amount of money in the bank to the console.

The Atm class has a transactionHistory property which keeps track of the withdrawals and deposits made to the account.

  • Make sure to indicate whether the transaction increased or decreased the amount of money in the bank.

Bonus

Give the Atm class a backupAccount property that can, optionally, contain a reference to another instance of the class, determined by some input

  • Whenever an ATM's balance goes below zero, it will remove money from the instance stored in backupAccount so that its balance goes back to zero.
  • This should trigger a withdrawal in the back up account equal to the amount of money that was withdrawn from the original account.