Class BankAccount

java.lang.Object
  extended byBankAccount

public class BankAccount
extends Object

A BankAccount object has a private field to keep track of this account's current balance, and public methods to return and change the balance.

Version:
1
See Also:
Bank

Constructor Summary
BankAccount(int initialBalance)
          A constructor for creating a new bank account.
 
Method Summary
 void deposit(int amount)
          Deposit the amount requested.
 int getBalance()
          The current account balance.
 void withdraw(int amount)
          Withdraw the amount requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BankAccount

public BankAccount(int initialBalance)
A constructor for creating a new bank account.

Parameters:
initialBalance - the opening balance.
Method Detail

deposit

public void deposit(int amount)
Deposit the amount requested.

Parameters:
amount - the amount to be deposited.

getBalance

public int getBalance()
The current account balance.

Returns:
the current balance.

withdraw

public void withdraw(int amount)
Withdraw the amount requested.

Parameters:
amount - the amount to be withdrawn.