Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ following steps: 1. Write declaration for an abstract class called Account t

ID: 3837595 • Letter: C

Question

C++

following steps:

1. Write declaration for an abstract class called Account that has an abstract public instance method called printInterest that returns void and has no parameters.

2. Write declaration for class Checking that derives from the Account class and that will have an implementation of Printlnterest() that overrides the base Account class' printlnterest() method.

3. Write declaration for class Savings that derives from the Account class and that will have an implementation of Printlnterest() that overrides the base Account class' printlnterest() method. Add a private double called interest to the Savings class that will hold the interest.

4. Write the implementation of the Checking class' printInterest method. Assume the checking account has 0 interest, ie, just print 0.

5. Write the implementation of the Saving class' printInterest method. It will just print the value of the interest instance variable. you dont need to multiply by 100 to get percentage.

Explanation / Answer

#include <iostream>

using namespace std;

class Account {
public:
virtual void printInterest()=0; // Pure virtual function.

};

class Checking:public Account
{
public:
void printInterest();
};

class Savings:public Account
{
private:
double interest;

public:
void printInterest();
};

void Checking::printInterest()
{
cout << "0" << endl;
}

void Savings::printInterest()
{
cout << interest << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote