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
|
#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
using namespace std;
class Bank
{
string firstname,lastname;
int age,account,n,i,number;
double balance,cashout,change,depo,newmoney,loan[1000];
public:
void getinfo();
void withdraw();
void showaccount();
void deposit();
void getnumbers();
void loanrepay(double loan[],int number);
};
void Bank::getinfo()
{
ofstream outputf("G:Bank information.xls",ios::app);
cout<<"Enter the client's first name"<<endl;
cin>>firstname;
cout<<"Enter the client's last name"<<endl;
cin>>lastname;
cout<<"Enter the client's age"<<endl;
cin>>age;
cout<<"Enter the client's new account number"<<endl;
cin>>account;
cout<<"Enter the client's first deposit"<<endl;
cin>>balance;
while(cin>>firstname>>lastname>>age>>account>>balance)
outputf<<"Firstname\tLastname\tage\taccount\tbalance"<<endl;
outputf<<firstname<<"\t"<<lastname<<"\t"<<age<<"\t"<<account<<"\t"<<balance<<endl;
outputf.close();
}
void Bank::showaccount()
{
ifstream input("G:Client's information.xls");
cout<<"Account Number is : "<<account<<endl;
cout<<"The Account Holder's Name is : "<<endl;
cout<<firstname<<lastname<<endl;
cout<<"The account's balance amount : "<<balance<<endl;
}
void Bank::getnumbers()
{
cout<<"How many clients do you have?"<<endl;
cin>>n;
cout<<"Enter amount loaned"<<endl;
for(int i=0;i<n;i++)
cin>>loan[i];
loanrepay(loan,n);
cout<<"The clients are supposed support to pay"<<endl;
for(int i=0;i<n;i++)
cout<<loan[i]<<endl;
}
void loanrepay(double loan[],int number)
{
int i;
for(int i=0;i<number;i++)
loan[i]=loan[i]*1.085;
}
void Bank::deposit()
{
ifstream input("G:Bank information.xls");
ofstream output("G:New Balance.xls");
cout << "Firstname\tLastname\tAge\tBank account number\tamount\tnew amount" << endl;
while (input >> firstname >> lastname >> age >> account)
newmoney=balance+depo;
cin>>depo;
output << firstname << "\t\t" << lastname << "\t\t" << age << "\t\t"<<account <<"\t\t"<<"\t\t"<<balance<<"\t\t"<<newmoney<<endl;
input.close();
}
void Bank::withdraw()
{
cout<<"Enter amount being withdrawn";
cin>>cashout;
ifstream inputf("G:Bank information.xls");
ofstream records("G:New client's info.xls");
while(inputf>>firstname>>lastname>>account>>balance)
{
change=balance-cashout;
records<<"First name\tLast name\tAccount number\tNew Balance"<<endl;
records<<firstname<<"\t"<<lastname<<"\t"<<account<<"\t"<<change<<endl;
}
inputf.close();
records.close();
}
int main()
{
int choice;
cout<<"WELCOME TO THE BANK"<<endl;
cout<<"Pick a service below"<<endl;
cout<<"1:Create new bank account"<<endl;
cout<<"2:Withdraw money from existing account"<<endl;
cout<<"3:Show account information"<<endl;
cout<<"4:Deposit money in an account"<<endl;
cout<<"5:View loans"<<endl;
cout<<"5:exit system"<<endl;
cin>>choice;
Bank create;
switch(choice)
{
case 1:
{
create.getinfo();
break;
}
case 2:
{
create.withdraw();
break;
}
case 3:
{
create.showaccount();
break;
}
case 4:
{
create.deposit();
break;
}
case 5:
{
create.getnumbers();
break;
}
case 6:
{
cout<<"Thank you for banking with us. Goodbye"<<endl;
break;
}
default:
{
cout<<"There is no such choice";
break;
}
}
return 0;
}
|