Class BankAccount

java.lang.Object
  |
  +--BankAccount

public class BankAccount
extends Object

This class models a bank account. It has a customer that owns the account and a balance


Constructor Summary
BankAccount(Customer theCustomer, double theBalance)
          Constructor that takes a customer and balance
 
Method Summary
 void deposit(double amount)
          Method to deposit money to an account
 Customer getCustomer()
          Method to get the customer
 String toString()
          Method to return information about this bank account in the form of a string
 double withdraw(Customer customer, double amount)
          Method to withdraw money from the account for the given customer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BankAccount

public BankAccount(Customer theCustomer,
                   double theBalance)
Constructor that takes a customer and balance

Method Detail

getCustomer

public Customer getCustomer()
Method to get the customer

Returns:
the customer associated with the account

withdraw

public double withdraw(Customer customer,
                       double amount)
Method to withdraw money from the account for the given customer

Parameters:
customer - the customer asking to do the withdrawal
Returns:
the amount withdrawn

deposit

public void deposit(double amount)
Method to deposit money to an account

Parameters:
amount - the amount to add to the account

toString

public String toString()
Method to return information about this bank account in the form of a string

Overrides:
toString in class Object
Returns:
id, customer name, and balance in a string