Class BankAccount

java.lang.Object
  extended by BankAccount

public class BankAccount
extends java.lang.Object


Constructor Summary
BankAccount(java.lang.String anAccountNumber)
          Constructs a bank account with a zero balance
BankAccount(java.lang.String anAccountNumber, double initialBalance)
          Constructs a bank account with a given balance
 
Method Summary
 void deposit(double amount)
          Deposits money into the bank account.
 java.lang.String getAccountNumber()
          Gets the account number of this bank account.
 double getBalance()
          Gets the current balance of the bank account.
 java.lang.String toString()
          Overrudes the toString method Returns a string representation of this account and its values.
 void withdraw(double amount)
          Withdraws money from the bank account
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BankAccount

public BankAccount(java.lang.String anAccountNumber)
Constructs a bank account with a zero balance

Parameters:
anAccountNumber - the account number for this account

BankAccount

public BankAccount(java.lang.String anAccountNumber,
                   double initialBalance)
Constructs a bank account with a given balance

Parameters:
anAccountNumber - the account number for this account
initialBalance - the initial balance
Method Detail

getAccountNumber

public java.lang.String getAccountNumber()
Gets the account number of this bank account.

Returns:
the account number

deposit

public void deposit(double amount)
Deposits money into the bank account.

Parameters:
amount - the amount to deposit

withdraw

public void withdraw(double amount)
Withdraws money from the bank account

Parameters:
amount - the amount to withdraw

getBalance

public double getBalance()
Gets the current balance of the bank account.

Returns:
the current balance

toString

public java.lang.String toString()
Overrudes the toString method Returns a string representation of this account and its values.

Overrides:
toString in class java.lang.Object