Class BankAccount

java.lang.Object
  extended by BankAccount
All Implemented Interfaces:
Measurable

public class BankAccount
extends java.lang.Object
implements Measurable

A bank account has a balance that can be changed by deposits and withdrawals.


Constructor Summary
BankAccount()
          Constructs a bank account with a zero balance.
BankAccount(double initialBalance)
          Constructs a bank account with a given balance.
 
Method Summary
 void deposit(double amount)
          Deposits money into the bank account.
 double getBalance()
          Gets the current balance of the bank account.
 double getMeasure()
          Computes the measure of the object.
 void withdraw(double amount)
          Withdraws money from the bank account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BankAccount

public BankAccount()
Constructs a bank account with a zero balance.


BankAccount

public BankAccount(double initialBalance)
Constructs a bank account with a given balance.

Parameters:
initialBalance - the initial balance
Method Detail

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

getMeasure

public double getMeasure()
Description copied from interface: Measurable
Computes the measure of the object.

Specified by:
getMeasure in interface Measurable
Returns:
the measure