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
|
#include <iostream>
#include <fstream>
using namespace std;
class SavingsAccount
{
public:
void addDeposit(float, float)
{
float deposit;
float balance;
balance = (balance + deposit);
return balance;
}
void subWithdraw(float, float)
{
float withdraw;
float balance;
balance = (balance - withdraw);
return balance;
}
void addInterest(float)
{
float newRate;
intRate = newRate;
return intrate;
}
float getBalance()
{
cout << balance << endl;
}
bool matchAccount(int, int)
{
int accNo;
int matchNo;
while (accNo != matchNo)
return false;
}
private:
int accNo;
double balance;
float intRate;
};
class Customer
{
public:
Customer c;
SavingsAccount s;
Transaction t;
void createCust(string, string, int)
{
cout << "This routine allows staff to enter new customer data." << endl;
cout << "Enter the customer details as follows:" << endl;
cout << "first name, last name [Return] address [Return] account number [Return]." << endl;
cin >> name;
cin >> address;
cin >> saveAcntNo;
}
bool searchAccounts(int)
{
while (accountNo != accNo)
return false;
}
void applyTrans(char)
{
Transaction t;
switch(t.transType)
{
case 'C':
SavingsAccount.addDeposit(SavingsAccount.balance, );
Transaction.readRecord();
break;
case 'D':
SavingsAccount.subWithdraw();
Transaction.readRecord();
break;
case 'I':
SavingsAccount.addInterest();
Transaction.readRecord();
break;
}
}
private:
string name;
string address;
int saveAcntNo;
};
class Transaction
{
public:
void readRecord(ifstream)
{
float line1;
float line2;
char line3;
if (!inFile.eof())
{
inFile >> line1;
inFile >> line2;
inFile >> line3;
Transaction.findAccount(line1);
}
else
{
s.getBalance();
}
}
int findAccount(s.accNo, t.saveAcntNo)
{
SavingsAccount s;
Transaction t;
if (s.accNo == t.saveAcntNo)
Customer.applyTrans();
else
(s.accNo++; t.findAccount());
}
private:
int accountNo;
float amount;
char transType;
};
class Process
{
public:
void setUpAccounts()
{
SavingsAccount accnts[7] =
{SavingsAccount(123456,0.0,0.05),
{SavingsAccount(246890,0.0,0.05),
{SavingsAccount(293567,0.0,0.05),
{SavingsAccount(337761,0.0,0.05),
{SavingsAccount(846579,0.0,0.05),
{SavingsAccount(917355,0.0,0.05),
{SavingsAccount(937568,0.0,0.05)};
}
processAll()
{
SavingsAccount s;
Customer c;
Transaction t;
Process p;
s.setUpAccounts();
s.getBalance();
t.readRecord(ifstream);
t.findAccount();
c.applyTrans();
}
};
int main()
{
ifstream inFile;
inFile.open("trans.dat");
Process p;
p.processAll();
system("pause");
}
|