Abstract BankAccount with Withdraw
mediumQuestion 197An abstract class BankAccount is provided with a balance field, a deposit(double amount) method, and an abstract withdraw(double amount) method.
Create a SavingsAccount class that extends BankAccount.
Requirements:
1. Constructor takes an initial balance and passes it to super().
2. Implement withdraw(double amount): only subtract from balance if amount <= balance. If not enough funds, do nothing.
3. Add a getBalance() method that returns the current balance.
Do NOT write a main method.
Expected output
800.0 800.0
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Abstract ClassesClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.