CJCoding With Joseph
15free / daySign inCreate account

Savings Account Class

An abstract base class Account is provided with pure virtual methods and a ready-made printBalance() method.

Create a class SavingsAccount that inherits from Account and:
- Has a constructor SavingsAccount(double initialBalance) that sets the starting balance
- Implements deposit(double amount): adds amount to the balance
- Implements withdraw(double amount): subtracts amount from the balance
- Implements getBalance(): returns the current balance

Do NOT write a main function.

Expected Output:

Balance: 120

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

Hints4 available
Topics:
Abstract Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.