← Back to Abstract Classes
Question 197
Abstract BankAccount with Withdraw
Abstract BankAccount with Withdraw
An abstract classBankAccountis provided with abalancefield, adeposit(double amount)method, and an abstractwithdraw(double amount)method. Create aSavingsAccountclass that extendsBankAccount. Requirements: 1. Constructor takes an initialbalanceand passes it tosuper(). 2. Implementwithdraw(double amount): only subtract from balance ifamount <= balance. If not enough funds, do nothing. 3. Add agetBalance()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 — 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.