CJCoding With Joseph
15free / daySign inCreate account

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

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
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.