export enum AccountType { Checking , Savings } ; /** Represents a bank account */ export class Account { private name : string ; constructor ( private accountType , private balance ) { this . name = accountType === AccountType . Checking ? "Fee Maximizer Checking" : "Interest Free Savings" ; this . balance = balance ; } public getAccountType ( ) { return this . accountType ; } public getName ( ) { return this . name ; } public getBalance ( ) { return this . balance ; } public depositMoney ( amount ) { if ( ! isNaN ( amount ) && amount > 0 ) { this . balance = this . balance + amount ; } } public withdrawMoney ( amount ) { if ( ! isNaN ( amount ) && amount > 0 ) { if ( amount > this . balance ) { throw new Error ( "Amount exceeds balance" ) ; } this . balance = this . balance - amount ; } } }