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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started