A small bank keeps a ledger: a record of its accounts and of every money movement. Build a BankLedger class.
new BankLedger() starts with no accounts. Amounts are whole numbers of cents. A transaction is one successful deposit, withdrawal or transfer. Each transaction gets an id: 1 for the first, then 2, 3 and so on. Failed calls never use up an id.
Input: bank.open("ana", 100); bank.open("ben")
bank.transfer("ana", "ben", 40)
[bank.balance("ana"), bank.balance("ben")]
Output: [60, 40]transfer returned id 1
It comes in 3 parts, each building on the last: Accounts and transfers, History with filters, Rollback.