Class Ledger

java.lang.Object
  extended by Ledger

public class Ledger
extends java.lang.Object

A ledger is a collection of accounts stored as a HashMap. Each account is accessed by its unique integer identifier.

Version:
(a version number or a date)
Author:
(your name)

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

Ledger

public Ledger()
Constructor for objects of class Ledger

Method Detail

addAccount

public void addAccount(int id,
                       Account acc)
Add a new account to the accounts HashMap

Parameters:
id - the unique account number
acc - the account object to be stored in the HashMap

processTransaction

public void processTransaction(Transaction t)
Given a transaction, get its account number and look up the corresponding account object in the accounts HashMap. Invoke "doTransaction for that account on the transaction"

Parameters:
t - a transaction object

report

public void report()
Iterate through all the accounts in the ledger and call report for each of them


updateAccounts

public void updateAccounts(Journal J)
Given a Journal, iterate through all its transactions and process each transaction.

Parameters:
J - a journal objecy