CJCoding With Joseph
15per day

Abstract BankAccount with Withdraw

An 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
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.