2 accounts on a ATM Project HELP DUE TOMORROW!

second cpp file
#include "ATMfinal.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

//bool exitProgram = false;
string bankName = "Livecchi National Credit Union";

//initialize
bankAccount::bankAccount(string Name)
{
bankBalance = 1000;
setBankersName(Name);
}

//sets account name
void bankAccount::setBankersName(string name)
{
bankName = name;
}
//get name
string bankAccount::getBankName()
{
return bankName;
}
//set balance
double bankAccount::getBankBalance()
{
return bankBalance;
}

void bankAccount::displayBalance()
{
system("cls");
cout << "Viewing account balance for account: \"" << getBankName() << "\"" << endl << endl;
for(int i = 0; i < 100; i++) // menu's block
cout << "\280" << endl;
cout << accountName << endl;
for(int i = 0; i < 40; i++)
cout << "~";
cout << endl << fixed << "Bank Account Balance is: $" << setprecision(2) << bankBalance << endl << endl;
cout << endl;
system("PAUSE");
}
//transfer $
void bankAccount::transMoney2( bankAccount &bankAccount, double amount)
{
bankBalance -= amount;
cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << endl << endl;
cout << fixed << setprecision(2) << bankAccount.getBankName() << "Balance: $" << bankAccount.
getBankBalance() << endl << endl;
system("PAUSE");
}
void bankAccount::depositMoney(double amount)
{
bankBalance += amount;
cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
system("PAUSE");
}
void bankAccount::withdrawlMoney(double amount)
{
bankBalance -= amount;
cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
system("PAUSE");
}

void showBankMenu(bankAccount &, bankAccount &)
{
int selected = 0;
double amount;
system("CLS");
cout << "Manage a " << ::bankName << " account: \"" << bankAccount.getBankName() << "\"" << endl << endl;
for(int i = 0; i < 100; i++)
cout << "\250";
cout << endl;
cout << "1- View Bank Account Balance" << endl;
cout << "2- Deposit money to this Account" << endl;
cout << "3- Withdrawl money from this Account" << endl;
cout << "4- *Return to Main Menu*" << bankName << " Account" << endl;
cout << "Enter Choice: " << endl;
cin >> selected;
switch(selected)
{
case 1:
bankAccount.displayBalance();
break;
case 2:
cout << endl << "Enter deposit amount: $";
cin >> amount;
transCheck(bankAccount, amount, false);
bankAccount.depositMoney(amount);
break;
case 3:
cout << endl << "Enter withdrawl amount: ($" << bankAccount.getBankBalance() << " available): $";
cin >> amount;
transCheck(bankAccount, amount, true);
bankAccount.withdrawlMoney(amount);
break;
case 4:
break;
default:
cout << endl << "Invalid Entry please try again" << endl << endl;
system("PAUSE");
break;
}
}

void manageBankAccount(/*bankAccount &checking, bankAccount &savings*/)
{
int selection;
system("cls");
cout << "Welcome to " << ::bankName << "." << endl << endl;
for(int i = 0; i < 100;)
cout << "\190";
cout << endl;

cout << "1- Manage " << checking.getBankName() << endl;
cout << "2- Manage " << savings.getBankName() << endl;
cout << "3-Transfer Money" << endl;
cout << "4- Exit " << sabings.getBankName() << endl;
cout << "Enter Selection: ";
cin >> selection;
switch(selection)
{
case 1:
showBankMenu(checking);
break;
case 2:
showBankMenu(savings);
break;
case 3:
transMenu(checking, savings);
break;
case 4:
::exitProgram = true;
break;
default:
cout << endl << "Invalid entry please try again" << endl << endl;
system("PAUSE")
break;
}
}

void transMenu(bankAccount &account1, Account &account2)
{
int selection;
double transAmount = 0.00;
system("CLS");
cout << "Transfer money between account: " << ::BankName << endl << endl;
for(int i = 0; i < 80; i++)
cout << "\190";
cout << endl;

cout << "1- Transfer from \"" << account1.getBankName() << "to" << account2.getBankName() << "\"" << endl;

cout << "2- Transfer from \"" << account2.getBankName() << "to" << account1.getBankName() << "\"" << endl;

cout << "Back to Main Menu" << endl;

cout << endl << "Enter Selection: ";
cin >> selection;
switch(selection)
{
case 1:
cout << endl << "Enter amount of transfer ($" << account1.getBankBalance() << " available): $";
cin >> transAmount;
transCheck(account1, transAmount, true);

account1.transMoney2(account2, transAmount);
break;
case 2:
cout << endl << "Enter amount of transfer ($" << account2.getBankBalance() << " available): $";
cin >> transAmount;
transCheck(account2, transAmount, true);

account2.transMoney2(account1, transAmount);
break;
case 3:
break;
default:
cout << endl << "Invalid entry please try again" << endl << endl;
system("PAUSE")
break;
}
}
void transCheck(/*bankAccount, double &amount, bool checkOverdrawl*/)
{
if(fmod((amount * 100), 1) != 0.00)
{
cout << endl << "This entry is invalid. Cancelling..." << endl;
amount = 0;
}

else if(amount < 0)
{
cout << endl << "Cannot transfer a Negative amount." << endl;
amount = 0;
}
else
{
cout << endl << " Transaction Processing " << endl;
}
}
bool getProgStat()
{
return exitProgram;
}

main.cpp

#include <iostream>
#include <string>
#include "ATMfinal.h"
using namespace std;

int main()
{
bankAccount checking("Checking Account");
bankAccount savings("Savings Account");

do
{
manageBankAccounts(checking, savings);
system("CLS");
cin.clear();
cin.ignore(80, '\n');
}while(getProgStat() == false);
}


header file - ATMfinal.h

//Jesse Livecchi
//ATM Final

#include <string>
//using namespace std;

class bankAccount
{
public:
bankAccount(std::string);
std::string getBankName();
double getBankBalance();
void setBankersName(string);
void withdrawlMoney(double);
void depositMoney(double);
void transMoney2(bankAccount &, double);
void displayBalance();
private:
std::string accountName;
double bankBalance;
};
void showBankMenu(bankAccount &);
void manageBankAccounts(bankAccount &, bankAccount &);
void transMenu(bankAccount &, bankAccount &);
void transCheck(bankAccount, double &amount, bool);
bool getProgStat();

i am getting this error and cant find out how to fix it please help its due tomorrow!!!

1>------ Build started: Project: ATM, Configuration: Debug Win32 ------
1>ATMfinal.obj : error LNK2019: unresolved external symbol "void __cdecl transCheck(class bankAccount,double &,bool)" (?transCheck@@YAXVbankAccount@@AAN_N@Z) referenced in function "void __cdecl showAccountMenu(class bankAccount &)" (?showAccountMenu@@YAXAAVbankAccount@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl getProgStat(void)" (?getProgStat@@YA_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl manageBankAccounts(class bankAccount &,class bankAccount &)" (?manageBankAccounts@@YAXAAVbankAccount@@0@Z) referenced in function _main
1>C:\Users\Jesse\Desktop\C++\ATM\Debug\ATM.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Use code tags in post!
second cpp 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#include "ATMfinal.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

//bool exitProgram = false;
string bankName = "Livecchi National Credit Union";

//initialize
bankAccount::bankAccount(string Name)
{
    bankBalance = 1000;
    setBankersName(Name);
}

//sets account name
void bankAccount::setBankersName(string name)
{
    bankName = name;
}
//get name
string bankAccount::getBankName()
{
    return bankName;
}
//set balance
double bankAccount::getBankBalance()
{
    return bankBalance;
}

void bankAccount::displayBalance()
{
    system("cls");
    cout << "Viewing account balance for account: \"" << getBankName() << "\"" << endl << endl;
    for(int i = 0; i < 100; i++) // menu's block
    cout << "\280" << endl;
    cout << accountName << endl;
    for(int i = 0; i < 40; i++)
    cout << "~";
    cout << endl << fixed << "Bank Account Balance is: $" << setprecision(2) << bankBalance << endl << endl;
    cout << endl;
    system("PAUSE");
}
//transfer $
void bankAccount::transMoney2( bankAccount &bankAccount, double amount)
{
    bankBalance -= amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << endl << endl;
    cout << fixed << setprecision(2) << bankAccount.getBankName() << "Balance: $" << bankAccount.
    getBankBalance() << endl << endl;
    system("PAUSE");
}
void bankAccount::depositMoney(double amount)
{
    bankBalance += amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
    system("PAUSE");
}
void bankAccount::withdrawlMoney(double amount)
{
    bankBalance -= amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
    system("PAUSE");
}

void showBankMenu(bankAccount &, bankAccount &)
{
    int selected = 0;
    double amount;
    system("CLS");
    cout << "Manage a " << ::bankName << " account: \"" << bankAccount.getBankName() << "\"" << endl << endl;
    for(int i = 0; i < 100; i++)
    cout << "\250";
    cout << endl;
    cout << "1- View Bank Account Balance" << endl;
    cout << "2- Deposit money to this Account" << endl;
    cout << "3- Withdrawl money from this Account" << endl;
    cout << "4- *Return to Main Menu*" << bankName << " Account" << endl;
    cout << "Enter Choice: " << endl;
    cin >> selected;
    switch(selected)
    {
        case 1:
        bankAccount.displayBalance();
        break;
        case 2:
        cout << endl << "Enter deposit amount: $";
        cin >> amount;
        transCheck(bankAccount, amount, false);
        bankAccount.depositMoney(amount);
        break;
        case 3:
        cout << endl << "Enter withdrawl amount: ($" << bankAccount.getBankBalance() << " available): $";
        cin >> amount;
        transCheck(bankAccount, amount, true);
        bankAccount.withdrawlMoney(amount);
        break;
        case 4:
        break;
        default:
        cout << endl << "Invalid Entry please try again" << endl << endl;
        system("PAUSE");
        break;
    }
}

void manageBankAccount(/*bankAccount &checking, bankAccount &savings*/)
{
    int selection;
    system("cls");
    cout << "Welcome to " << ::bankName << "." << endl << endl;
    for(int i = 0; i < 100;)
    cout << "\190";
    cout << endl;
    
    cout << "1- Manage " << checking.getBankName() << endl;
    cout << "2- Manage " << savings.getBankName() << endl;
    cout << "3-Transfer Money" << endl;
    cout << "4- Exit " << sabings.getBankName() << endl;
    cout << "Enter Selection: ";
    cin >> selection;
    switch(selection)
    {
        case 1:
        showBankMenu(checking);
        break;
        case 2:
        showBankMenu(savings);
        break;
        case 3:
        transMenu(checking, savings);
        break;
        case 4:
        ::exitProgram = true;
        break;
        default:
        cout << endl << "Invalid entry please try again" << endl << endl;
        system("PAUSE")
        break;
    }
}

void transMenu(bankAccount &account1, Account &account2)
{
    int selection;
    double transAmount = 0.00;
    system("CLS");
    cout << "Transfer money between account: " << ::BankName << endl << endl;
    for(int i = 0; i < 80; i++)
    cout << "\190";
    cout << endl;
    
    cout << "1- Transfer from \"" << account1.getBankName() << "to" << account2.getBankName() << "\"" << endl;
    
    cout << "2- Transfer from \"" << account2.getBankName() << "to" << account1.getBankName() << "\"" << endl;
    
    cout << "Back to Main Menu" << endl;
    
    cout << endl << "Enter Selection: ";
    cin >> selection;
    switch(selection)
    {
        case 1:
        cout << endl << "Enter amount of transfer ($" << account1.getBankBalance() << " available): $";
        cin >> transAmount;
        transCheck(account1, transAmount, true);
        
        account1.transMoney2(account2, transAmount);
        break;
        case 2:
        cout << endl << "Enter amount of transfer ($" << account2.getBankBalance() << " available): $";
        cin >> transAmount;
        transCheck(account2, transAmount, true);
        
        account2.transMoney2(account1, transAmount);
        break;
        case 3:
        break;
        default:
        cout << endl << "Invalid entry please try again" << endl << endl;
        system("PAUSE")
        break;
    }
}
void transCheck(/*bankAccount, double &amount, bool checkOverdrawl*/)
{
    if(fmod((amount * 100), 1) != 0.00)
    {
        cout << endl << "This entry is invalid. Cancelling..." << endl;
        amount = 0;
    }
    
    else if(amount < 0)
    {
        cout << endl << "Cannot transfer a Negative amount." << endl;
        amount = 0;
    }
    else
    {
        cout << endl << " Transaction Processing " << endl;
    }
}
bool getProgStat()
{
    return exitProgram;
}


main.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
main.cpp

#include <iostream>
#include <string>
#include "ATMfinal.h"
using namespace std;

int main()
{
    bankAccount checking("Checking Account");
    bankAccount savings("Savings Account");
    
    do
    {
        manageBankAccounts(checking, savings);
        system("CLS");
        cin.clear();
        cin.ignore(80, '\n');
    }while(getProgStat() == false);
}


header file - ATMfinal.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
//Jesse Livecchi
//ATM Final

#include <string>
//using namespace std;

class bankAccount
{
    public:
    bankAccount(std::string);
    std::string getBankName();
    double getBankBalance();
    void setBankersName(string);
    void withdrawlMoney(double);
    void depositMoney(double);
    void transMoney2(bankAccount &, double);
    void displayBalance();
    private:
    std::string accountName;
    double bankBalance;
};
void showBankMenu(bankAccount &);
void manageBankAccounts(bankAccount &, bankAccount &);
void transMenu(bankAccount &, bankAccount &);
void transCheck(bankAccount, double &amount, bool);
bool getProgStat();


You are getting this error and cant find out how to fix it please help its due tomorrow!!!

1>------ Build started: Project: ATM, Configuration: Debug Win32 ------
1>ATMfinal.obj : error LNK2019: unresolved external symbol "void __cdecl transCheck(class bankAccount,double &,bool)" (?transCheck@@YAXVbankAccount@@AAN_N@Z) referenced in function "void __cdecl showAccountMenu(class bankAccount &)" (?showAccountMenu@@YAXAAVbankAccount@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl getProgStat(void)" (?getProgStat@@YA_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl manageBankAccounts(class bankAccount &,class bankAccount &)" (?manageBankAccounts@@YAXAAVbankAccount@@0@Z) referenced in function _main
1>C:\Users\Jesse\Desktop\C++\ATM\Debug\ATM.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I did some formating and tagging, so atleast it is readable.
From the code itself what I see that it has compiler errors, The one you have pointer are linker errors which occurs after the successful compilation only(if there is any).

So the compiler errors are:
In second cpp file, the function definition of showBankMenu is incorrect.

void showBankMenu(bankAccount &, bankAccount &)

this syntax is valid for declaration purpose but while defining it is required to provide the variable names as

void showBankMenu(bankAccount &acc1, bankAccount &acc2)


In ATMfinal.h
In declaration of function setBankersName the argument type should be

void setBankersName(std::string);

Function transCheck is declared like:

void transCheck(bankAccount, double &amount, bool);

whereas defined as

void transCheck(/*bankAccount, double &amount, bool checkOverdrawl*/)


First check whether you have shared the correct code or not.
Last edited on
thanks for the fix of my coding display...first post so i wasn't sure how to post it correctly but the code still is giving me the same error...

but my continued error with

void showBankMenu(bankAccount &acc1, bankAccount &acc2)
void setBankersName(std::string);
void transCheck(bankAccount, double &amount, bool);
void transCheck(bankAccount, double &amount, bool checkOverdrawl) fixed

i still get this--

1>------ Build started: Project: ATM, Configuration: Debug Win32 ------
1>ATMfinal.obj : error LNK2019: unresolved external symbol "void __cdecl transCheck(class bankAccount,double &,bool)" (?transCheck@@YAXVbankAccount@@AAN_N@Z) referenced in function "void __cdecl showAccountMenu(class bankAccount &)" (?showAccountMenu@@YAXAAVbankAccount@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl getProgStat(void)" (?getProgStat@@YA_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl manageBankAccounts(class bankAccount &,class bankAccount &)" (?manageBankAccounts@@YAXAAVbankAccount@@0@Z) referenced in function _main
1>C:\Users\Jesse\Desktop\C++\ATM\Debug\ATM.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

sorry again for not knowing how to site the code correctly
prototypes before the class...

You'll excuse me if I don't read the entire thing. (sarcasm)
Last edited on
so i fixed that by putting them in public... i think. this is my first time ever doing any programming im in programming in c++ as my first semester at college and i dont really know what im doing at all...and what i have done has changed my error type.

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#include "ATMfinal.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

//bool exitProgram = false;
string bankName = "Livecchi National Credit Union";

//initialize
bankAccount::bankAccount(string Name)
{
    bankBalance = 1000;
    setBankersName(Name);
}

//sets account name
void bankAccount::setBankersName(string name)
{
    bankName = name;
}
//get name
string bankAccount::getBankName()
{
    return bankName;
}
//set balance
double bankAccount::getBankBalance()
{
    return bankBalance;
}

void bankAccount::displayBalance()
{
    system("cls");
    cout << "Viewing account balance for account: \"" << getBankName() << "\"" << endl << endl;
    for(int i = 0; i < 100; i++) // menu's block
    cout << "\280" << endl;
    cout << accountName << endl;
    for(int i = 0; i < 40; i++)
    cout << "~";
    cout << endl << fixed << "Bank Account Balance is: $" << setprecision(2) << bankBalance << endl << endl;
    cout << endl;
    system("PAUSE");
}
//transfer $
void bankAccount::transMoney2( bankAccount &bankAccount, double amount)
{
    bankBalance -= amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << endl << endl;
    cout << fixed << setprecision(2) << bankAccount.getBankName() << "Balance: $" << bankAccount.
    getBankBalance() << endl << endl;
    system("PAUSE");
}
void bankAccount::depositMoney(double amount)
{
    bankBalance += amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
    system("PAUSE");
}
void bankAccount::withdrawlMoney(double amount)
{
    bankBalance -= amount;
    cout << endl << fixed << setprecision(2) << accountName << "Balance is now: $" << bankBalance << endl << endl;
    system("PAUSE");
}

void bankAccount::showBankMenu(bankAccount, bankAccount)
{
    int selected = 0;
    double amount;
    system("CLS");
    cout << "Manage a " << ::bankName << " account: \"" << bankAccount.getBankName() << "\"" << endl << endl;
    for(int i = 0; i < 100; i++)
    cout << "\250";
    cout << endl;
    cout << "1- View Bank Account Balance" << endl;
    cout << "2- Deposit money to this Account" << endl;
    cout << "3- Withdrawl money from this Account" << endl;
    cout << "4- *Return to Main Menu*" << bankName << " Account" << endl;
    cout << "Enter Choice: " << endl;
    cin >> selected;
    switch(selected)
    {
        case 1:
        bankAccount.displayBalance();
        break;
        case 2:
        cout << endl << "Enter deposit amount: $";
        cin >> amount;
        transCheck(bankAccount, amount, false);
        bankAccount.depositMoney(amount);
        break;
        case 3:
        cout << endl << "Enter withdrawl amount: ($" << bankAccount.getBankBalance() << " available): $";
        cin >> amount;
        transCheck(bankAccount, amount, true);
        bankAccount.withdrawlMoney(amount);
        break;
        case 4:
        break;
        default:
        cout << endl << "Invalid Entry please try again" << endl << endl;
        system("PAUSE");
        break;
    }
}

void manageBankAccount(bankAccount &checking, bankAccount &savings)
{
    int selection;
    system("cls");
    cout << "Welcome to " << ::bankName << "." << endl << endl;
    for(int i = 0; i < 100;)
    cout << "\190";
    cout << endl;
    
    cout << "1- Manage " << checking.getBankName() << endl;
    cout << "2- Manage " << savings.getBankName() << endl;
    cout << "3-Transfer Money" << endl;
    cout << "4- Exit " << savings.getBankName() << endl;
    cout << "Enter Selection: ";
    cin >> selection;
    switch(selection)
    {
        case 1:
        showBankMenu(checking);
        break;
        case 2:
        showBankMenu(savings);
        break;
        case 3:
        transMenu(checking, &savings);
        break;
        case 4:
        ::exitProgram = true;
        break;
        default:
        cout << endl << "Invalid entry please try again" << endl << endl;
        system("PAUSE")
        break;
    }
}

void transMenu(bankAccount &account&, account2)
{
    int selection;
    double transAmount = 0.00;
    system("CLS");
    cout << "Transfer money between account: " << ::BankName << endl << endl;
    for(int i = 0; i < 80; i++)
    cout << "\190";
    cout << endl;
    
    cout << "1- Transfer from \"" << account1.getBankName() << "to" << account2.getBankName() << "\"" << endl;
    
    cout << "2- Transfer from \"" << account2.getBankName() << "to" << account1.getBankName() << "\"" << endl;
    
    cout << "Back to Main Menu" << endl;
    
    cout << endl << "Enter Selection: ";
    cin >> selection;
    switch(selection)
    {
        case 1:
        cout << endl << "Enter amount of transfer ($" << account1.getBankBalance() << " available): $";
        cin >> transAmount;
        transCheck(account1, transAmount, true);
        
        account1.transMoney2(account2, transAmount);
        break;
        case 2:
        cout << endl << "Enter amount of transfer ($" << account2.getBankBalance() << " available): $";
        cin >> transAmount;
        transCheck(account2, transAmount, true);
        
        account2.transMoney2(account1, transAmount);
        break;
        case 3:
        break;
        default:
        cout << endl << "Invalid entry please try again" << endl << endl;
        system("PAUSE")
        break;
    }
}
void transCheck(/*bankAccount, double &amount, bool checkOverdrawl*/)
{
    if(fmod((amount * 100), 1) != 0.00)
    {
        cout << endl << "This entry is invalid. Cancelling..." << endl;
        amount = 0;
    }
    
    else if(amount < 0)
    {
        cout << endl << "Cannot transfer a Negative amount." << endl;
        amount = 0;
    }
    else
    {
        cout << endl << " Transaction Processing " << endl;
    }
}
bool getProgStat()
{
    return exitProgram;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
#include "ATMfinal.h"
using namespace std;

int main()
{
	bankAccount checking("Checking Account");
	bankAccount savings("Savings Account");

	do
	{
		manageBankAccounts(checking, savings);
		system("CLS");
		cin.clear();
		cin.ignore(80, '\n');
	}while(getProgStat() == false);
}



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
//Jesse Livecchi
//ATM Final

#include <string>
using namespace std;

class bankAccount
{
public:
	bankAccount(string);
	string getBankName();
	double getBankBalance();
	void setBankersName(string);
	void withdrawlMoney(double);
	void depositMoney(double);
	void transMoney2(bankAccount &, double);
	void showBankMenu(bankAccount &);
	void manageBankAccounts(bankAccount &, bankAccount &);
	void transMenu(bankAccount &, bankAccount &);
	void transCheck(bankAccount, double &, bool);
	bool getProgStat();
	void displayBalance();
private:
	string accountName;
	double bankBalance;
};



error list:


error list:

1>------ Build started: Project: ATM, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\jesse\desktop\c++\atm\atm\main.cpp(13): error C3861: 'manageBankAccounts': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\main.cpp(17): error C3861: 'getProgStat': identifier not found
1> ATMfinal.cpp
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(70): error C2511: 'void bankAccount::showBankMenu(bankAccount,bankAccount)' : overloaded member function not found in 'bankAccount'
1> c:\users\jesse\desktop\c++\atm\atm\atmfinal.h(8) : see declaration of 'bankAccount'
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(128): error C3861: 'showBankMenu': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(131): error C3861: 'showBankMenu': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(134): error C3861: 'transMenu': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(137): error C2039: 'exitProgram' : is not a member of '`global namespace''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(137): error C2065: 'exitProgram' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(142): error C2143: syntax error : missing ';' before 'break'
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(146): error C2143: syntax error : missing ',' before '&'
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(151): error C2039: 'BankName' : is not a member of '`global namespace''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(151): error C2065: 'BankName' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(156): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(156): error C2228: left of '.getBankName' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(156): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(156): error C2228: left of '.getBankName' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(158): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(158): error C2228: left of '.getBankName' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(158): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(158): error C2228: left of '.getBankName' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(167): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(167): error C2228: left of '.getBankBalance' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(169): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(169): error C3861: 'transCheck': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(171): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(171): error C2228: left of '.transMoney2' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(171): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(174): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(174): error C2228: left of '.getBankBalance' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(176): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(176): error C3861: 'transCheck': identifier not found
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(178): error C2065: 'account2' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(178): error C2228: left of '.transMoney2' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(178): error C2065: 'account1' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(185): error C2143: syntax error : missing ';' before 'break'
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(190): error C2065: 'amount' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(193): error C2065: 'amount' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(196): error C2065: 'amount' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(199): error C2065: 'amount' : undeclared identifier
1>c:\users\jesse\desktop\c++\atm\atm\atmfinal.cpp(208): error C2065: 'exitProgram' : undeclared identifier
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I would seperate this into sections:

- Account (a class to handle and keep track of all of the transactions and data relating to them)

- user information (if we make a vector<account_class>, then a user can have more than 1 account!)

- whatever else...

This way, you can treat your objects more like objects instead of.... well... an item... When you make a class, you want to make it general. Like a value, but an object.

If we were to create an account class with a generic (and unique) id that identified that account, we could tie that id to somthing else, like a person. This would make it easy to write, and then emplement, because you're just create a basic account, not any specific account, etc... You can define types of accounts, and have a short that represents this type. The member functions can use this to define their actions.

example:
1
2
3
4
5
6
7
#define CHECKING 1

//prototype for a function that will take the short acc_type and return a string that is the name of that type
string name_account_type(const short&);

//..somwhere in a member function
cout<< ((name_account_type(this->acc_type).size() > 0) ? name_account_type(this->acc_type) : "Error: Invalid type!")<< endl;


What you do is up to you though.
Topic archived. No new replies allowed.