Class Account

java.lang.Object
  extended by Account

public class Account
extends java.lang.Object

represents a bank account


Constructor Summary
Account(Customer customer, java.lang.String accountNumber)
          Constructor for objects of type Account
 
Method Summary
 void addTransaction(Transaction newTransaction)
          adds a new Transaction object to the array of contained objects
 java.lang.String getAccountNumber()
          returns the account number
 double getBalance()
          returns the account balance
 java.lang.String getCustomerName()
          returns the customer name
 Transaction getTransaction(java.lang.String reference)
          gets a contained Transaction object specified by its reference property.
 Transaction[] getTransactions()
          gets the array of contained Transaction objects
 void printDetails()
          prints details of the account and its current transactions
 void removeTransaction(java.lang.String reference)
          removes a contained Transaction object specified by its reference property.
 java.lang.String toString()
          returns a String representation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Account

public Account(Customer customer,
               java.lang.String accountNumber)
Constructor for objects of type Account

Parameters:
customer - the customer
accountNumber - the account number
Method Detail

addTransaction

public void addTransaction(Transaction newTransaction)
adds a new Transaction object to the array of contained objects

Parameters:
newTransaction - the new Transaction to add

getAccountNumber

public java.lang.String getAccountNumber()
returns the account number

Returns:
the account number

getBalance

public double getBalance()
returns the account balance

Returns:

getCustomerName

public java.lang.String getCustomerName()
returns the customer name

Returns:
the customer name

getTransaction

public Transaction getTransaction(java.lang.String reference)
gets a contained Transaction object specified by its reference property.

Parameters:
reference - the reference property value of the target object
Returns:
the target Transaction object

getTransactions

public Transaction[] getTransactions()
gets the array of contained Transaction objects

Returns:
the array of contained Transaction objects

printDetails

public void printDetails()
prints details of the account and its current transactions


removeTransaction

public void removeTransaction(java.lang.String reference)
removes a contained Transaction object specified by its reference property.

Parameters:
reference - the reference property value of the target object

toString

public java.lang.String toString()
returns a String representation of this object

Overrides:
toString in class java.lang.Object
Returns:
a String represention of this object