Class BankAccount

java.lang.Object
  extended by BankAccount

public class BankAccount
extends java.lang.Object

This class represents a single bank account


Constructor Summary
BankAccount(java.lang.String theName, int theAccountNum)
          Constructs a new bank account with initial balance of $0
BankAccount(java.lang.String theName, int theAccountNum, double initialBalance)
          Constructs a new bank account
 
Method Summary
 double addInterest()
          Adds interest to the account
 double deposit(double amount)
          Deposits money into the account
 int getAccountNumber()
          Returns the account number
 double getBalance()
          Returns the current balance
 java.lang.String getOwnerName()
          Returns the name of the account owner
 java.lang.String toString()
          Returns a String representation of the bank account
 double withdrawal(double amount)
          Withdraws money from the 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 theName,
                   int theAccountNum)
Constructs a new bank account with initial balance of $0

Parameters:
theName - The name of the owner of the account
theAccountNum - The account number

BankAccount

public BankAccount(java.lang.String theName,
                   int theAccountNum,
                   double initialBalance)
Constructs a new bank account

Parameters:
theName - The name of the owner of the account
theAccountNum - The account number
initialBalance - The initial balance
Method Detail

addInterest

public double addInterest()
Adds interest to the account

Returns:
The balance after interest has been added

deposit

public double deposit(double amount)
Deposits money into the account

Parameters:
amount - The amount of money to be deposited
Returns:
The current balance after the deposit

getAccountNumber

public int getAccountNumber()
Returns the account number

Returns:
The account id number

getBalance

public double getBalance()
Returns the current balance

Returns:
The current balance of the account

getOwnerName

public java.lang.String getOwnerName()
Returns the name of the account owner

Returns:
The name of the owner of the account

toString

public java.lang.String toString()
Returns a String representation of the bank account

Overrides:
toString in class java.lang.Object
Returns:
A string representing the state of the bank account

withdrawal

public double withdrawal(double amount)
Withdraws money from the account

Parameters:
amount - The amount of money to be withdrawn
Returns:
The current balance after the withdrawal