Class BankAccount

java.lang.Object
  extended by BankAccount

public class BankAccount
extends java.lang.Object

A bank account has a balance and an owner who can make deposits to and withdrawals from the account.


Constructor Summary
BankAccount()
          Default constructor for a bank account with zero balance
BankAccount(double initialBalance, java.lang.String name)
          Construct a balance account with a given initial balance and owner’s name
 
Method Summary
 void deposit(double dAmount)
          Method for depositing money to the bank account
 double getBalance()
          Method for getting the current balance of the bank account
static void main(java.lang.String[] args)
          Main method for testing the bank account
 void withdraw(double wAmount)
          Method for withdrawing money from the bank account
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BankAccount

public BankAccount()
Default constructor for a bank account with zero balance


BankAccount

public BankAccount(double initialBalance,
                   java.lang.String name)
Construct a balance account with a given initial balance and owner’s name

Parameters:
initialBalance - the initial balance
name - name of owner
Method Detail

deposit

public void deposit(double dAmount)
Method for depositing money to the bank account

Parameters:
dAmount - the amount to be deposited

getBalance

public double getBalance()
Method for getting the current balance of the bank account

Returns:
the current balance

main

public static void main(java.lang.String[] args)
Main method for testing the bank account


withdraw

public void withdraw(double wAmount)
Method for withdrawing money from the bank account

Parameters:
wAmount - the amount to be withdrawn