Question: Question 3 (Abstract Classes): 5 Points 1. Define an abstract class called Savable : public abstract class Savable { // ONE variable called : SAVING_RATE

Question 3 (Abstract Classes): 5 Points

1. Define an abstract class called Savable:

public abstract class Savable {

// ONE variable called : SAVING_RATE of type double and set to 0.2

// One abstract method called apply_savings() that takes the number of years as input argument and returns the applied savings rate.

}

2.1 Let the class BankAccount extend the Savable class. Complete the class definition below:

public class BankAccount {

2.2 The BankAccount class will override the apply_savings() inherited from the Savable class where it will return the product between the BankAccount balance field and the input argument defining the number of years. Complete the code below:

// DO all necessary checks (input argument cannot be negative!)!

@Override

apply_savings( ) {

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!