C++ error assistance, please assist

C++ Error, please help.

My brain is just a little fried, I wrote this in the last 10 hours. I'm receiving the following errors at the end of my cpp. I know they are not shown to be declared, but I'm fried, please assist with where to put them to declare.

[Error] 'class bankAccount' has no member named 'print'

[Error] 'class bankAccount' has no member named 'createMonthlyStatement'

/////////////////////////////////

//main.cpp

////////////////////////////////

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>

#include "bankAccount.h"
#include "SavingsAccount.h"
#include "HighInterestSavings.h"
#include "NoServiceChargeChecking.h"
#include "ServiceChargeChecking.h"
#include "HighInterestChecking.h"
#include "CertificateOfDeposit.h"
#include "checkingAccount.h"

using namespace std;
  
int main()
{
vector accountsList;

   //SavingsAccount( Name, Account number, Balance ) - Assume an interest rate = 0.03
accountsList.push_back(new SavingsAccount("Bill", 10200, 2500));

   //HighInterestSavings(Name, Account Number, Balance) -- Assume an interest rate = 0.05, Minimum balance = $2500
accountsList.push_back(new HighInterestSavings("Susan", 10210, 2000));

   //NoServiceChargeChecking(Name, Account Number, Balance) -- Assume an interest rate = 0.02, Minimum balance = $1000
accountsList.push_back(new NoServiceChargeChecking("John", 20100, 3500));

   //ServiceChargeChecking(Name, Account Number, Balance) -- Assume account service charge = $10, Maximum number of checks = 5, Service Charee Excess Number of Checks = $5
accountsList.push_back(new ServiceChargeChecking("Ravi", 30100, 1800));

   //HighIntererestChecking(Name, Account Number, Balance) - Assume an inerest rate = 0.05, Minimum balance = $5000
accountsList.push_back(new HighInterestChecking("Sheila", 20200, 6000));

   //Certificate(name, Account Number, Balance, Interest Rate, Number of Months) - Assume an initial interest rate = 0.05, Initial Number of Maturity Months = 6
accountsList.push_back(new CertificateOfDeposit("Hamid", 51001, 18000, 0.075, 18));

cout << "January:\n-------------" << endl;
for (int i = 0; i < accountsList.size(); i++)
{
accountsList[i]->createMonthlyStatement();
accountsList[i]->print();
cout << endl;
}

cout << "\nFebruary:\n-------------" << endl;
for (int i = 0; i < accountsList.size(); i++)
{
accountsList[i]->createMonthlyStatement();
accountsList[i]->print();
cout << endl;
}

for (int i = 0; i < accountsList.size(); i++)
{
accountsList[i]->withdraw(500);
}

cout << "\nMarch:\n-------------" << endl;
for (int i = 0; i < accountsList.size(); i++)
{
accountsList[i]->createMonthlyStatement();
accountsList[i]->print();
cout << endl;
}
system("pause");
return 0;
}


////////////////////////////////////////

//bankAccount.h

////////////////////////////////////////

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <iomanip>
#include <string>

#ifndef BANKACCOUNT_H
#define BANKACCOUNT_H

using namespace std;

class bankAccount
{
public:
bankAccount(string name, int acctNum, double initialBalance)
{
m_Name = name;
   m_AcctNumber = acctNum;
m_Balance = initialBalance;
}

~bankAccount(void){}

string get_Name()
{
return m_Name;
}

int get_AcctNumber()
{
return m_AcctNumber;
}

double get_Balance()
{
return m_Balance;
}

void deposit(double amount)
{
m_Balance += amount;
cout << "$" << amount << " has been deposited to your account" << endl;
}

virtual void withdraw(double amount) = 0;
virtual void printStatement() = 0;
virtual void printSummary()
{
cout << setw(60) << setfill('-') << "" << setfill(' ') << endl;
cout << endl << setw(25) << "" << "Account Summary" << endl << endl;
cout << setw(25) << "Name: " << m_Name << endl;
cout << setw(25) << "Account #: " << m_AcctNumber << endl;
cout << setw(25) << "Current Balance: $" << m_Balance << endl;
}

protected:
string m_Name;
int m_AcctNumber;
double m_Balance;
};
#endif 
Last edited on
closed account (48T7M4Gy)
The error message says it all.

You realise you haven't got either of the two members described so that's good.

The place you put them is indicated in the error message ie the bankAccount class if your compiler has 'understood' your intentions correctly. Keep in mind it's really your call how you go about designing your program.

To keep it simple though, put them in bankAccount.
Last edited on
Topic archived. No new replies allowed.