Class CheckingAccount

java.lang.Object
  extended by BankAccount
      extended by CheckingAccount

public class CheckingAccount
extends BankAccount

A checking account retains all the features of a bank account. However, a fee of $0.25 is charged for each withdraw (also, balance must always be positive).


Constructor Summary
CheckingAccount()
          Creates a checking account with initial balance equal to zero.
CheckingAccount(double balance)
          Creates a checking account with the given initial balance.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks whether two checking accounts are equal.
 boolean withdraw(double amount)
          Each withdraw charges a fee of $0.25.
 
Methods inherited from class BankAccount
deposit, getAccountNumber, getBalance, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CheckingAccount

public CheckingAccount(double balance)
Creates a checking account with the given initial balance.

Parameters:
balance - Initial balance

CheckingAccount

public CheckingAccount()
Creates a checking account with initial balance equal to zero.

Method Detail

withdraw

public boolean withdraw(double amount)
Each withdraw charges a fee of $0.25. Performs the withdrawal and returns true if the final balance is not negative, after both the amount and fee are removed; otherwise leaves balance unchanged and returns false.

Specified by:
withdraw in class BankAccount
Parameters:
amount - Withdrawal amaount
Returns:
True if successful, false if unsuccessful

equals

public boolean equals(java.lang.Object o)
Checks whether two checking accounts are equal. They are equal if their balances are equal.

Overrides:
equals in class BankAccount
Parameters:
o - Object to be compared
Returns:
True if equal, false otherwise