Repository navigation
Expand file tree
/
Copy pathbank_Account.cpp
More file actions
122 lines (117 loc) · 2.65 KB
/
Copy pathbank_Account.cpp
File metadata and controls
122 lines (117 loc) · 2.65 KB
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
#include <iostream>
using namespace std;
class bank
{
private:
double balance;
double transactions;
public:
bank(double);
void setbalance(double);
void setwithdraw(double);
double getbalance();
double gettransection();
static int satVariable;
};
bank::bank(double value = 0)
{
cout << "constuctor 1 is calling " << endl;
cout << "Default Value set to balance" << endl;
balance = value;
transactions = value;
}
int bank::satVariable = 500;
void bank::setbalance(double makeDeposit)
{
if (makeDeposit > 0)
{
balance = balance + makeDeposit;
cout << "\nDeposit money successfully " << endl;
transactions++;
}
else
{
cout << "negative value not allowed" << endl;
}
}
void bank::setwithdraw(double withdraw)
{
if (withdraw <= balance && balance > 0)
{
balance = balance - withdraw;
cout << "\nWithdraw money successfully " << endl;
transactions++;
}
else
{
cout << "withdraw money is greater than balance " << endl;
}
}
double bank::getbalance()
{
return balance;
}
double bank::gettransection()
{
return transactions;
}
int main()
{
bank obj1;
// cout << obj1.balance2;
cout << bank::satVariable;
cout << " ";
double makeDeposit, withdraw;
int choice;
do
{
cout << "BANK ACCOUNT " << endl;
cout << "1. Make Deposit " << endl;
cout << "2. With Draw Money " << endl;
cout << "3. Check Balance " << endl;
cout << "4. Total Transections " << endl;
cout << "5. EXIT " << endl;
cout << "\n Enter Choice " << endl;
cout << "-----------------------------------" << endl;
cin >> choice;
switch (choice)
{
case 1:
{
cout << "enter the value : ";
cin >> makeDeposit;
obj1.setbalance(makeDeposit);
}
break;
case 2:
{
cout << "\nenter value to withdraw form account : ";
cin >> withdraw;
obj1.setwithdraw(withdraw);
}
break;
case 3:
{
cout << "\nThe balance is : " << obj1.getbalance() << endl;
}
break;
case 4:
{
cout << "your total Transections are : " << obj1.gettransection() << endl;
}
break;
case 5:
{
cout << "Program END.." << endl;
cout << "------------------------------" << endl;
}
break;
default:
{
cout << "invalid choice " << endl;
}
break;
}
} while (choice != 5);
return 0;
}