public class SavingsAccount extends AbstractBankAccount
balance
Constructor and Description 

SavingsAccount(long balance,
double interestRate,
long withdrawalFee)
Create a savings account given the amounts of the starting balance,
the daily interest rate, and withdrawal fee.

Modifier and Type  Method and Description 

double 
getInterestRate()
Get the interest rate

long 
getWithdrawalFee()
Get the withdrawal fee.

void 
setInterestRate(double interestRate)
Set the interest rate.

void 
setWithdrawalFee(long withdrawalFee)
Set the withdrawal fee.

void 
update()
Update the account balance to add interest earned on the
account balance.

void 
withdraw(long amount)
Withdraw an amount of currency from the account.

deposit, getBalance
public SavingsAccount(long balance, double interestRate, long withdrawalFee)
balance
 the starting balanceinterestRate
 the daily interest ratewithdrawalFee
 the fee associated with each withdrawalpublic final double getInterestRate()
public final void setInterestRate(double interestRate)
IllegalArgumentException
 if interestRate < 0
interestRate
 the new interest ratepublic final long getWithdrawalFee()
public final void setWithdrawalFee(long withdrawalFee)
IllegalArgumentException
 if withdrawalFee < 0
withdrawalFee
 the new withdrawal feepublic void withdraw(long amount)
withdraw
in class AbstractBankAccount
AbstractBankAccount.withdraw(long)
amount
 the amount to withdraw from the accountpublic void update()
The interest earned is calculated using floating point arithmetic and then rounded to the nearest integer before being added to the balance.
update
in class AbstractBankAccount
AbstractBankAccount.update()