Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me with this error I am getting? Everything else is working perfect. It is supposed to be seven files. The errors are

Can you help me with this error I am getting? Everything else is working perfect.

It is supposed to be seven files. The errors are coming from my bankAccountTest page.

Errors: C2661 'checkingAccount::checkingAccount': no overloaded function takes 6 arguments"

I have the same incoding: "checkingAccount::checkingAccount() {}" as I do in my SavingsAccount files but it says its wrong for my checking account files. Can syou helo me correct my bankAccountTest file to get this code to work and not throw errors.

I can't add my savingsAccount files as it says its too long to post but they work perfectly fine. Thank you in advance.

bankAccount.h

#ifndef BANKACCOUNT_H

#define BANKACCOUNT_H

//Include the required header file.

#include

using namespace std;

//Define the class.

class bankAccount

{

//Define the data members.

protected:

int accountNumber;

string name;

double balance;

//Define the methods.

public:

bankAccount();

~bankAccount();

bankAccount(string name, int accountNumber, double balance);

int getAccountNumber();

double getBalance();

string getName();

void setName(string name);

double deposit(double Amt);

virtual double withdraw(double Amt);

virtual void print();

virtual void createMonthlyStatement() = 0;

};

#endif

bankAccount.cpp

#include "bankAccount.h"

#include

#include

//Using the standard namespace.

using namespace std;

//Define the default constructor.

bankAccount::bankAccount() {}

//Define the destructor.

bankAccount::~bankAccount() {}

//Define the parametrized constructor.

bankAccount::bankAccount(string name, int acctNum, double startBal)

{

this->accountNumber = acctNum;

this->name = name;

this->balance = startBal;

}

//Define the method to deposit the amount.

double bankAccount::deposit(double Amt)

{

balance += Amt;

return balance;

}

//Define the getter methods.

int bankAccount::getAccountNumber()

{

return accountNumber;

}

double bankAccount::getBalance()

{

return balance;

}

string bankAccount::getName() {

return this->name;

}

//Define the method to print the details.

void bankAccount::print()

{

cout << "Your account Number: " << getAccountNumber() << endl;

cout << "Your current balance: $" << getBalance() << endl;

}

//Define the method to withdraw the amount.

double bankAccount::withdraw(double Amt)

{

balance -= Amt;

return balance;

}

checkingAccount.cpp

#include "checkingAccount.h"

#include "bankAccount.h"

#include

#include

//Define the default constructor.

checkingAccount::checkingAccount() {}

//Defien the parametrized constructor.

checkingAccount::checkingAccount(string name, int acctNum, double startBal, double mBalance, double iRate, double sCharge, double fee) : bankAccount(name, acctNum, startBal)

{

this->interestRate = iRate;

this->minimumBalance = mBalance;

this->serviceCharge = sCharge;

this->fee = fee;

}

//Define the destructor.

checkingAccount::~checkingAccount() {}

//Define the getter methods.

double checkingAccount::getInterestRate()

{

return interestRate;

}

double checkingAccount::getMinimumBalance()

{

return minimumBalance;

}

double checkingAccount::getServiceCharge()

{

return serviceCharge;

}

//Define the method to calculate the interest.

double checkingAccount::postInterest()

{

if (balance <= 0)

{

return 0;

}

double interest = 0;

interest = bankAccount::balance * (interestRate);

bankAccount::balance += interest;

bankAccount::balance = bankAccount::balance;

return interest;

}

//Define the method to print the record.

void checkingAccount::print()

{

cout << "Interest Checking ACCT#: " << getAccountNumber();

cout << "\tbalance: $" << fixed << setprecision(2) << getBalance();

cout << "\tInterest Rate = " << fixed << setprecision(2) << getInterestRate() * 100 << "%";

}

//Define the stter methods.

void checkingAccount::setInterestRate(double intRate)

{

interestRate = intRate;

}

void checkingAccount::setMinimumBalance(double minBalance)

{

minimumBalance = minBalance;

}

void checkingAccount::setServiceCharge(double srvCharge)

{

serviceCharge = srvCharge;

}

//Define the to verify the minimum balance.

bool checkingAccount::verifyMinimumBalance()

{

bool balanceBelow = false;

if (bankAccount::balance < minimumBalance)

balanceBelow = true;

return balanceBelow;

}

//Define the method to withdraw the amount.

double checkingAccount::withdraw(double withdrawalAmt)

{

if ((bankAccount::balance - withdrawalAmt) < 0)

{

cout << endl << "This will overdraw your account! Can not withdraw." << endl;

}

else

{

bankAccount::balance -= withdrawalAmt;

if (verifyMinimumBalance())

{

balance -= getServiceCharge();

cout << "You've dropped below your minimum balacnce!" << endl;

cout << "You've been charged a fee of $" << getServiceCharge() << endl;

}

}

return bankAccount::balance;

}

//Define the method to perform the write check.

void checkingAccount::writeCheck(string recipient, double checkAmount)

{

if ((balance - checkAmount) < 0)

{

cout << "Insufficient funds" << endl;

return;

}

withdraw(checkAmount);

if (verifyMinimumBalance())

{

balance -= getServiceCharge();

cout << "You've dropped below your minimum balacnce!" << endl;

cout << "You've been charged a fee of $" << getServiceCharge();

}

cout << endl << "Check sent to " << recipient << " for $" << checkAmount << endl;

cout << "Your current balance is $" << getBalance() << endl;

}

//Define the method to create the monthly service statement.

void checkingAccount::createMonthlyStatement() {

postInterest();

bankAccount::balance = bankAccount::balance - getServiceCharge();

}

checkingAccount.h

#ifndef CHECKINGACCOUNT_H

#define CHECKINGACCOUNT_H

//Include the reauired header file.

#include "bankAccount.h"

//Using the standard namespace.

using namespace std;

//Define the class.

class checkingAccount :public bankAccount

{

//Define the data members.

private:

double interestRate;

double minimumBalance;

double serviceCharge;

double fee;

//Define the member functions.

public:

checkingAccount();

~checkingAccount();

checkingAccount(string name, int acctNum, double startBal, double mBalance, double iRate, double sCharge, double f);

double getMinimumBalance();

void setMinimumBalance(double minBalance);

double getInterestRate();

void setInterestRate(double intRate);

double getServiceCharge();

void setServiceCharge(double srvCharge);

double postInterest();

void writeCheck(string recipient, double checkAmount);

double withdraw(double withdrawalAmt);

void print();

bool verifyMinimumBalance();

void createMonthlyStatement();

};

#endif

bankAccountTest.cpp

#include

#include

#include "savingsAccount.h"

#include "checkingAccount.h"

using namespace std;

int main()

{

bankAccount* accountsList[6];

accountsList[0] = new checkingAccount("Bill", 10200, 25000, 100, 0.012, 10.00);

accountsList[1] = new checkingAccount("Bob", 10210, 10000, 100, 0.0099, 15.00);

accountsList[2] = new savingsAccount("Susan", 90001, 20000, 0.031);

accountsList[3] = new savingsAccount("Steve", 90002, 50000, 0.041);

accountsList[4] = new checkingAccount("Sally", 10220, 4999, 100, 0.0079, 20.00);

accountsList[5] = new savingsAccount("Frad", 90003, 2000, 0.011);

cout << "January: -------------" << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

cout << " February: -------------" << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

for (int i = 0; i < 6; i++)

{

accountsList[i]->withdraw(500);

}

cout << " March: -------------" << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago