← Back to Abstract Classes
Question 171
Savings Account Class
Savings Account Class
An abstract base classAccountis provided with pure virtual methods and a ready-madeprintBalance()method. Create a classSavingsAccountthat inherits fromAccountand: - Has a constructorSavingsAccount(double initialBalance)that sets the starting balance - Implementsdeposit(double amount): addsamountto the balance - Implementswithdraw(double amount): subtractsamountfrom the balance - ImplementsgetBalance(): 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
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.