Savings Account Class
mediumQuestion 171An 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, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
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.