In: Computer Science
What would you have to change in savings account for the abstract method to work in Java?
If you have abstract method like deposit(), withdraw() and applyInterest() method
Then to implement these method you can change the implemention like as
1) deposit have no charge
2) withdraw is free for 5 transaction and then deduct balance 1$( or as you wish) for each transaction after 5 transaction
3) implement applyInterest() or your abstract method in Account class or super class of SavingAccount class
apply the interest on balance as per given rate.
These change you can made in the implementation of your abstract method
For example
public void deposit(double amount) { balance += amount; }
public void withdraw(double amount) { if(countWithdraw<=5){ balance -= amount; } else{ balance -= amount-1; } countWithdraw++; }
public void applyInterest(){
balance+=monthlyInterest;//as per your choice
}
Please let me know if you have any doubt or modify the answer, Thanks :)