|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBankAccount
public class BankAccount
Constructor Summary | |
---|---|
BankAccount()
Creates a bank account with initial balance of zero. |
|
BankAccount(BankAccount b)
Copy constructor -- creates a bank account that is a copy of the existing bank account |
|
BankAccount(double balance)
Creates a bank account with the given balance. |
Method Summary | |
---|---|
void |
deposit(double amount)
Deposits the given amount to the account. |
boolean |
equals(java.lang.Object o)
Checks to see if two bank accounts are equal. |
int |
getAccountNumber()
Returns the account number. |
double |
getBalance()
Returns the current balance of the account. |
java.lang.String |
toString()
Transforms the class into a string of the following form (for example, if the balance is 10.56): [BankAccount:balance=10.56] |
boolean |
withdraw(double amount)
Withdraws the given amount from the account and returns true if the resulting balance is positive. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BankAccount(double balance)
balance
- Initial balance for the accountpublic BankAccount()
public BankAccount(BankAccount b)
b
- Bank account to be copiedMethod Detail |
---|
public void deposit(double amount)
amount
- Amount of the depositpublic boolean withdraw(double amount)
amount
- Amount of the withdrawal
public double getBalance()
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
- Bank account to check for equality
public int getAccountNumber()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |