java.lang.ObjectLedger
public class Ledger
A ledger is a collection of accounts stored as a HashMap. Each account is accessed by its unique integer identifier.
Constructor Summary | |
---|---|
Ledger()
Constructor for objects of class Ledger |
Method Summary | |
---|---|
void |
addAccount(int id,
Account acc)
Add a new account to the accounts HashMap |
void |
processTransaction(Transaction t)
Given a transaction, get its account number and look up the corresponding account object in the accounts HashMap. |
void |
report()
Iterate through all the accounts in the ledger and call report for each of them |
void |
updateAccounts(Journal J)
Given a Journal, iterate through all its transactions and process each transaction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Ledger()
Method Detail |
---|
public void addAccount(int id, Account acc)
id
- the unique account numberacc
- the account object to be stored in the HashMappublic void processTransaction(Transaction t)
t
- a transaction objectpublic void report()
public void updateAccounts(Journal J)
J
- a journal objecy