edu.trinity.cs.bmassing.bank
Class Account

java.lang.Object
  extended by edu.trinity.cs.bmassing.bank.Account
All Implemented Interfaces:
HasPersonName
Direct Known Subclasses:
CheckingAccount, SavingsAccount

public abstract class Account
extends java.lang.Object
implements HasPersonName

Class for bank accounts. (If I had more to say about this class, I could say it here.)


Field Summary
protected  double balance
           
static int BANK_ROUTING_NUMBER
           
 
Constructor Summary
Account(double balance, java.lang.String name, int accountNumber)
          Constructor allowing setting initial values of all variables.
 
Method Summary
abstract  double addInterest()
          Compute and add interest.
 double deposit(double amount)
          Deposit some money.
 int getAccountNumber()
          Get account number.
 double getBalance()
          Get balance.
 java.lang.String getName()
          Get account name.
 java.lang.String getPersonName()
          Get associated person's name.
static void main(java.lang.String[] args)
          Main program to do some simple tests.
 double withdraw(double amount)
          Withdraw some money.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

balance

protected double balance

BANK_ROUTING_NUMBER

public static final int BANK_ROUTING_NUMBER
See Also:
Constant Field Values
Constructor Detail

Account

public Account(double balance,
               java.lang.String name,
               int accountNumber)
Constructor allowing setting initial values of all variables.

Method Detail

deposit

public double deposit(double amount)
Deposit some money.

Parameters:
amount -
Returns:
new balance

withdraw

public double withdraw(double amount)
Withdraw some money.

Parameters:
amount -
Returns:
new balance
Throws:
java.lang.RuntimeException - if amount is more than balance

getName

public java.lang.String getName()
Get account name.


getBalance

public double getBalance()
Get balance.


getAccountNumber

public int getAccountNumber()
Get account number.


addInterest

public abstract double addInterest()
Compute and add interest.

Returns:
new balance

getPersonName

public java.lang.String getPersonName()
Description copied from interface: HasPersonName
Get associated person's name.

Specified by:
getPersonName in interface HasPersonName

main

public static void main(java.lang.String[] args)
Main program to do some simple tests.

Parameters:
args - command-line arguments (unused)