java.lang.ObjectBankAccount
public class BankAccount
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 |
---|
public BankAccount()
public BankAccount(double initialBalance, java.lang.String name)
initialBalance
- the initial balancename
- name of ownerMethod Detail |
---|
public void deposit(double dAmount)
dAmount
- the amount to be depositedpublic double getBalance()
public static void main(java.lang.String[] args)
public void withdraw(double wAmount)
wAmount
- the amount to be withdrawn