java.lang.ObjectBankAccount
public class BankAccount
This class represents a single bank account
Constructor Summary | |
---|---|
BankAccount(java.lang.String theName,
int theAccountNum)
Constructs a new bank account with initial balance of $0 |
|
BankAccount(java.lang.String theName,
int theAccountNum,
double initialBalance)
Constructs a new bank account |
Method Summary | |
---|---|
double |
addInterest()
Adds interest to the account |
double |
deposit(double amount)
Deposits money into the account |
int |
getAccountNumber()
Returns the account number |
double |
getBalance()
Returns the current balance |
java.lang.String |
getOwnerName()
Returns the name of the account owner |
java.lang.String |
toString()
Returns a String representation of the bank account |
double |
withdrawal(double amount)
Withdraws money from the account |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BankAccount(java.lang.String theName, int theAccountNum)
theName
- The name of the owner of the accounttheAccountNum
- The account numberpublic BankAccount(java.lang.String theName, int theAccountNum, double initialBalance)
theName
- The name of the owner of the accounttheAccountNum
- The account numberinitialBalance
- The initial balanceMethod Detail |
---|
public double addInterest()
public double deposit(double amount)
amount
- The amount of money to be deposited
public int getAccountNumber()
public double getBalance()
public java.lang.String getOwnerName()
public java.lang.String toString()
toString
in class java.lang.Object
public double withdrawal(double amount)
amount
- The amount of money to be withdrawn