Class SavingsAccount

java.lang.Object
  extended by SavingsAccount

public class SavingsAccount
extends java.lang.Object

An encapsulation of a (simple) savings account at a bank


Constructor Summary
SavingsAccount(java.lang.String id)
          Construct a SavingsAccount object with an initial balance of 0.00. Note: A deep copy of the id is made.
 
Method Summary
 void deposit(double amount)
          Increase the balance of this SavingsAccount.
 double getBalance()
          Get the current balance in this SavingsAccount.
 java.lang.String getID()
          Get the identifier for this SavingsAccount.
 void withdraw(double amount)
          Reduce the balance of this SavingsAccount (if there are sufficient funds)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SavingsAccount

public SavingsAccount(java.lang.String id)
Construct a SavingsAccount object with an initial balance of 0.00

Parameters:
id - The identifier for this SavingsAccount
Method Detail

deposit

public void deposit(double amount)
Increase the balance of this SavingsAccount.

Parameters:
amount - The amount of the deposit/increase

getBalance

public double getBalance()
Get the current balance in this SavingsAccount.

Returns:
The current balance (i.e., the deposits minus the withdrawals)

getID

public java.lang.String getID()
Get the identifier for this SavingsAccount.

Returns:
The ID

withdraw

public void withdraw(double amount)
Reduce the balance of this SavingsAccount (if there are sufficient funds)

Parameters:
amount - The amount of the withdrawal/reduction


James Madison University, Department of Computer Science