Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the constructor of the SavingsAccount class that is a subclass of the BankAccount class. public class SavingsAccount extends BankAccount { private double interestRate; public

Complete the constructor of the SavingsAccount class that is a subclass of the BankAccount class.

public class SavingsAccount extends BankAccount { private double interestRate;

public SavingsAccount(double initialBalance, double rate) {

// your work here

}

/** Adds the earned interest to the account balance. */ public void addInterest() { double interest = getBalance() * interestRate / 100; deposit(interest); } public static double check(double initialBalance, double rate) { SavingsAccount account = new SavingsAccount(initialBalance, rate); account.addInterest(); return account.getBalance(); } }

Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago