โ Back to 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
Topics:
Abstract ClassesClasses
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.