So sick of this Banking Project.

I have been working on this project for two and half days now. I know that isn't a long time, but it has been almost nonstop. I am so tired of looking at a screen haha.

I have these last two errors.

2\bankingsystem.cpp(46) : error C2511: 'int Account::getPassCode(void) const' : overloaded member function not found in 'Account'

1> 2\bankingsystem.h(9) : see declaration of 'Account'

2\bankingsystem.cpp(68) : error C2511: 'double Account::getBalance(void) const' : overloaded member function not found in 'Account'

Now, I know what the mean.
I know what they are asking.

But, how do I fix them without destroying what I have done?

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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

#include <iostream> //
#include <string>

using namespace std;

#include "BankingSystem.h"

// constructor
Account::Account( int accountNumberValue, 
				 int passCodeValue,
				 string lastNameValue, 
				 string firstNameValue, 
				 double balanceValue
 )


{
 setAccountNumber( accountNumberValue );
   setPassCode ( passCodeValue );
   setLastName( lastNameValue );
   setFirstName( firstNameValue );
   setBalance( balanceValue );
}
// end constructor

// return first name
	string Account::getFirstName()
	{
		return firstName;

	}// getFirstName

// return last name
	string Account::getLastName()
	{
		return lastName;

	}// end getLastName


int Account::getAccountNumber() 
{
	return accountNumber;

}
int Account::getPassCode() const
{
	return passCode;
}


//set first name
void Account::setFirstName( string &first )
{
	firstName = first;

} // end function setFIrstName

//set last name

void Account::setLastName( string &last )
{
	lastName = last;

}// end function setLastName


double Account::getBalance() const
{
	return balance;
}

void Account::setBalance( double balanceValue )
{
	balance = balanceValue; // should validate

} 

void Account::setPassCode( int passCodeValue )
{
	passCode = passCodeValue;

}



Here is my header file.

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
#ifndef BANKING_SYSTEM_H
#define BANKING_SYSTEM_H

#include <string> // Used to allow string functions
#include <vector>
#include <iostream> 


class Account {

public:

//and here's a default constructor.
Account( int accountNumberValue, int passCode, std::string lastName, 
           std::string firstName, double balance);

  Account() {accountNumber=passCode=0; balance=0.0; firstName=" "; lastName=" ";}
  ~Account();

  void setFirstName ( std::string & );
  std::string getFirstName();

  void setLastName( std::string & );
  std::string getLastName();

  void setAccountNumber( int accountNumberValue );
  int getAccountNumber();

  void setPassCode( int passCodeValue );
  int getPassCode();

  void setBalance( double balanceValue );
  double getBalance();


private:
  std::string firstName;
  std::string lastName;
  int accountNumber;
  int passCode;
  double balance;

};

class BankingSystem
{
public:
  BankingSystem();
  ~BankingSystem();

  Account query(int accountId);

  void addAccount();//option 1

  void deleteAccount();//option 2

  void AccountInquiry();//option 3

  void saveAccount();//option 4

  void loadAccounts();//option 5

private:
  std::vector<Account> accounts_;
};

#endif  
Just remove const from line 47 and 69 in your bankingSystem.cpp or add const to line 30 and 33 in your header file
http://stackoverflow.com/questions/3141087/what-is-meant-with-const-at-end-of-function-declaration

EDIT: Or create 2 headers in your header file:
int getPassCode() const; and double getBalance() const;
Last edited on
Hey, thank you for helping!

I did try this earlier, but every time I did, I got these errors.

1>bankingdriver.obj : error LNK2019: unresolved external symbol "public: __thiscall Account::~Account(void)" (??1Account@@QAE@XZ) referenced in function "void __cdecl createTextFile(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?createTextFile@@YAXAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)

1>bankingdriver.obj : error LNK2019: unresolved external symbol "void __cdecl outputLine(class std::basic_ostream<char,struct std::char_traits<char> > &,class Account const &)" (?outputLine@@YAXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@ABVAccount@@@Z) referenced in function "void __cdecl createTextFile(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?createTextFile@@YAXAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)

1>bankingdriver.obj : error LNK2019: unresolved external symbol "public: double __thiscall Account::getBalance(void)" (?getBalance@Account@@QAENXZ) referenced in function "void __cdecl updateRecord(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?updateRecord@@YAXAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)

1>bankingdriver.obj : error LNK2019: unresolved external symbol "public: void __thiscall Account::setAccountNumber(int)" (?setAccountNumber@Account@@QAEXH@Z) referenced in function "void __cdecl newRecord(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?newRecord@@YAXAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)

1>BankingSystem.obj : error LNK2001: unresolved external symbol "public: void __thiscall Account::setAccountNumber(int)" (?setAccountNumber@Account@@QAEXH@Z)
Last edited on
Hi silversidewalkstew,

Btw, try to avoid starting new topics about the same subject, just keep the original one going. I am sure I am not the only one who prefer to see 5 pages in one topic, rather than new topics about the same thing popping up all the time. And it is rather annoying when there are replies to multiple topics that cover the same ground over & over. Even though you marked the other one as solved - this doesn't stop people replying.

I know that the advice I gave in other topic probably means you would make major changes to your code, but I seriously urge you to take that advice on board. Am not trying to be mean, but if I was your tutor I would give your current code a grade of C+ say or 60%. If you make the changes I suggested, you might get a B+ or A 80 to 90% say.

I know it is hard : you have spent time on this, then I come along and say you need to change your whole approach, meaning you almost start again. But what I am saying is constructive, and would allow you to have less code that is much more elegant - always a good thing IMO. And the reward is higher marks, and a realisation that you are doing it well and more properly.

Also, what I have suggested you do, is not that hard to carry out. Use the constructor that I proposed, and get rid of the getters & setters.

If you are concerned that my advice isn't right, then show your tutor your current code, then ask what they think of my advice to you. Don't be afraid to point them to the particular posts on this forum. I think it should be OK for you to get help on a forum, especially if you can demonstrate to your tutor that you have learnt some good practice.

Also, if I am lucky, there are plenty of others on this forum with much more experience & knowledge than me, who might back up and reinforce what I am saying to you.

Let us know how you get on - cheers 8+D
Topic archived. No new replies allowed.