|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBankAccount
SavingsAccount
public class SavingsAccount
A savings account retains all the features of a bank account. However, if the balance is below a minimum balance, withdraws are not permitted. Furthermore, annual interest is deposited to the account at a specified interest rate. The minimum balance for this savings account is $1000.
Constructor Summary | |
---|---|
SavingsAccount()
Creates a savings account with initial balance equal to the minimum balance and interest rate equal to 2%. |
|
SavingsAccount(double balance,
double interestRate)
Creates a savings account with the given initial balance and interest rate. |
Method Summary | |
---|---|
void |
depositInterest()
Deposits annual interest to the account according to the interest rate. |
boolean |
equals(java.lang.Object o)
Checks whether two savings accounts are equal. |
void |
printBalance()
Prints the balance of the savings account. |
boolean |
withdraw(double amount)
Performs the withdrawal and returns true if the final balance is greater than the minimum balance, otherwise leaves balance unchanged and returns false. |
Methods inherited from class BankAccount |
---|
deposit, getAccountNumber, getBalance, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SavingsAccount(double balance, double interestRate)
balance
- Initial balanceinterestRate
- Interest ratepublic SavingsAccount()
Method Detail |
---|
public void depositInterest()
public boolean withdraw(double amount)
withdraw
in class BankAccount
amount
- Withdrawal amaount
public boolean equals(java.lang.Object o)
equals
in class BankAccount
o
- Object to be compared
public void printBalance()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |