Question: C++ , use abstract classes and pure virtual functions to design classes to manipulate various types of accounts. Savings accounts: Suppose that the bank offers

C++ , use abstract classes and pure virtual functions to design classes to manipulate various types of accounts. Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no minimum balance and a lower interest rate and another that requires a minimum balance and has a higher interest rate.

Having trouble with getting my driver.cpp project to run :

DRIVER.CPP

#include "stdafx.h"

#include

#include "savingsAccount.h"

#include "MinimumBalanceSavingsAccount.h"

using std::cout;

using std::endl;

void TestSavingsAccount(savingsAccount& account)

{

savingsAccount account("Joey", "100200300", 0.02);

cout << "Account owner: " << account.getAccountOwner() << endl

<< "Account number: " << account.getAccountNumber() << endl

<< "Interest rate: " << account.getInterestRate() << endl;

}

void TestMinimumBalanceSavingsAccount(MinimumBalanceSavingsAccount& account)

{

savingsAccount account("Joey", "100200300", 200, 0.02);

cout << "Minimum required balance: " << account.getminimumBalance() << endl

<< "Interest rate: " << account.getInterestRate() << endl;

}

int main()

{

TestMinimumBalanceSavingsAccount();

system("pause");

return 0;}

savingsAccount.h

#pragma once

#include

using std::string;

class savingsAccount

{

public:

savingsAccount(string, string, double);

string getAccountOwner() const;

string getAccountNumber() const;

double getInterestRate() const;

private:

string name;

string accountNumber;

double interestRate;

};

savingsAccount.cpp

#include "stdafx.h"

#include "savingsAccount.h"

savingsAccount::savingsAccount(string name, string number, double interestrate)

{

this->name = name;

this->accountNumber = number;

this->interestRate = 0.02;

}

string savingsAccount::getAccountNumber() const

{

return accountNumber;

}

string savingsAccount::getAccountOwner() const

{

return name;

}

double savingsAccount::getInterestRate() const

{

return interestRate;

}

MinimumBalanceSavingsAccount.h

#pragma once

#include "savingsAccount.h"

class MinimumBalanceSavingsAccount:

public savingsAccount

{

public:

MinimumBalanceSavingsAccount(string, string, double, double);

double getminimumBalance() const;

private:

double minimumBalance;

};

MinimumBalanceSavingsAccount.cpp

#include "stdafx.h"

#include "MinimumBalanceSavingsAccount.h"

MinimumBalanceSavingsAccount::MinimumBalanceSavingsAccount(string name, string number, double interestrate, double minimumBalance):

savingsAccount(name, number, interestrate)

{

this->minimumBalance = 200;

}

double MinimumBalanceSavingsAccount::getminimumBalance() const

{

return minimumBalance;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!