forked from aryangarg08/WebDev-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreated InteractiveBank
137 lines (126 loc) · 3.96 KB
/
Created InteractiveBank
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
#include <bits/stdc++.h>
using namespace std;
class Bank
{
public:
int balance;
int amount;
int withdraw;
int transfer;
string name= "nil" ;
string reason = "nil";
string address = "nil";
string aadharNo = "nil";
string accountType = "nil";
public:
void openAccount();
void closeAccount();
void depositAmount();
void withdrawAmount();
void displayAccount();
};
void Bank::openAccount()
{
cout << "Enter Your Name For Bank Account : " << endl;
cin>>name;
cout << "Enter Your Address For Bank Account : " << endl;
cin>>address;
cout << "Enter Your Aadhar Number For Bank Account : " << endl;
cin>>aadharNo;
cout << "Enter Your Account Type (Savings Or Current) For Bank Account : " << endl;
cin >> accountType;
cout << "Enter The Balance Amount You Want To Keep For Bank Account : " << endl;
cin >> balance;
}
void Bank::closeAccount()
{
cout << "Enter The Reason Why You Want To Close Your Bank Account?" << endl;
cin >> reason;
cout << "Your Balance Amount " << balance << " Will Be Transferred To Other Specified Account" << endl;
}
void Bank::displayAccount()
{
if(name == "nil" && address == "nil" && aadharNo == "nil" && accountType == "nil"){
cout<<"You Are Not A Customer Of Our Bank As We Cannot Find Your Account!";
cout<<endl;
cout<<"If You Want To Become Our Customer By Opening An Account Here, Press (Y/y) Followed By 1. ";
cout<<endl;
cout<<"Thank You! Have A Nice Day.";
cout<<endl;
}
else{
cout << "Your Name For Bank Account : " << name << endl;
cout << "Your Address For Bank Account : " << address << endl;
cout << "Your Aadhar Number For Bank Account : " << aadharNo << endl;
cout << "Your Account Type For Bank Account : " << accountType << endl;
cout << "Balance Amount In Bank Account : " << balance << endl;
}
}
void Bank::depositAmount()
{
cout << "Enter The Amount You Want To Deposit In Your Account : " << endl;
cin >> amount;
cout << "Initial Balance Amount Is : " << balance << endl;
balance += amount;
cout << "Amount Added Successfully In Account" << endl;
cout << "Renewed Amount Balance In Account Is " << balance << endl;
}
void Bank::withdrawAmount()
{
cout << "Enter The Amount You Want To Withdraw : " << endl;
cin >> withdraw;
cout << "Initial Balance Amount Is : " << balance << endl;
balance -= withdraw;
cout << "Amount Is Withdrawn Easily : " << endl;
cout << "Renewed Amount Balance In Account Is " << balance << endl;
}
int main()
{
int ch;
char choice;
Bank b;
do
{
cout << "\n****************** Welcome To Bank Management Sytem ******************" << endl;
cout << "Enter Your Choice Out Of Below Given Options to Complete Your Action" << endl;
cout << "1. Open Account" << endl;
cout << "2. Close Account" << endl;
cout << "3. Display Account Details" << endl;
cout << "4. Deposit Amount" << endl;
cout << "5. Withdraw Amount" << endl;
cout << "6. Exit From Bank" << endl;
cin >> ch;
switch (ch)
{
case 1:
b.openAccount();
break;
case 2:
b.closeAccount();
break;
case 3:
b.displayAccount();
break;
case 4:
b.depositAmount();
break;
case 5:
b.withdrawAmount();
break;
case 6:
cout << "Exited From Program!!" << endl;
break;
default:
cout << "You Entered Wrong Choice. Try Again!" << endl;
}
cout << "Do You Want To Continue? If Yes Press (Y/y)" << endl;
cout << "If No Press (N/n)" << endl;
cin >> choice;
if (choice == 'n' || choice == 'N')
{
cout << "Exited From Program!!" << endl;
exit(0);
}
} while (choice == 'y' || choice == 'Y');
return 0;
}