|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimpleBankAccount
public class SimpleBankAccount
Constructor Summary | |
---|---|
SimpleBankAccount()
Creates a bank account with initial balance 0 and account number 1. |
|
SimpleBankAccount(double initBalance,
int accountNumber)
Creates a bank account with the given initial balance and given account number. |
|
SimpleBankAccount(SimpleBankAccount b)
Copy constructor |
Method Summary | |
---|---|
void |
deposit(double amount)
Deposits the given amount to the account. |
boolean |
equals(java.lang.Object o)
Tests whether the given object is equal to this object. |
int |
getAccountNumber()
Returns the account number. |
double |
getBalance()
Returns the account balance. |
java.lang.String |
toString()
Returns a string representation of the object. |
int |
withdraw(double amount)
Withdraws the given amount from the account, as long as sufficient funds are available. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleBankAccount()
public SimpleBankAccount(double initBalance, int accountNumber)
initBalance
- Intial balanceaccountNumber
- Account numberpublic SimpleBankAccount(SimpleBankAccount b)
b
- Bank account to be copiedMethod Detail |
---|
public void deposit(double amount)
amount
- Amount to be depositedpublic int getAccountNumber()
public double getBalance()
public int withdraw(double amount)
amount
- Amount to be withdrawn
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to be tested for equality
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |