public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount(double amount,double interestRate) { super(); makeDeposit(amount); this.interestRate = interestRate; } // end constructor public void setInterest(double rate) { interestRate = rate; } // end setInterest public void calculateInterest() { double interest = getBalance()*interestRate; addToStatement("Interest earned: " + interest + "\n"); addToBalance(getBalance() + interest); addToStatement("New balance: " + getBalance() + "\n"); } // calculateInterest } // end SavingsAccount