forked from nikhilrevankar98/Bank-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank.py
208 lines (157 loc) · 5.61 KB
/
Bank.py
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
#import sys;
class BankAccount:
def __init__(self, accountNumber, name ):
self.__accountNumber = accountNumber
self.__name = name
def get_account_number(self):
return self.__accountNumber
def get_name(self):
return self.__name
def set_account_number(self, value):
self.__accountNumber = value
def set_name(self, value):
self.__name = value
class FixedDeposit(BankAccount):
def __init__(self, accountNumber, name, duration, amount, rateOfInterest ):
super().__init__(accountNumber,name)
self.__duration = duration
self.__amount = amount
self.__rateOfInterest = rateOfInterest
def get_duration(self):
return self.__duration
def get_amount(self):
return self.__amount
def get_rate_of_interest(self):
return self.__rateOfInterest
def set_duration(self, value):
self.__duration = value
def set_amount(self, value):
self.__amount = value
def set_rate_of_interest(self, value):
self.__rateOfInterest = value
class RecurringDeposit(BankAccount):
def __init__(self, accountNumber, name, duration, monthlyPayment, rateOfInterest ):
super().__init__(accountNumber,name)
self.__duration = duration
self.__monthlyPayment = monthlyPayment
self.__rateOfInterest = rateOfInterest
def get_duration(self):
return self.__duration
def get_monthly_payment(self):
return self.__monthlyPayment
def get_rate_of_interest(self):
return self.__rateOfInterest
def set_duration(self, value):
self.__duration = value
def set_monthly_payment(self, value):
self.__monthlyPayment = value
def set_rate_of_interest(self, value):
self.__rateOfInterest = value
class BankDemo:
n=0
ch='n'
def bankOptions(self):
print("******************************")
print(" Bank Account Demonstration ")
print("******************************")
print("1. Read & Write Fixed Deposit")
print("2. Read & Write Recurring Deposit")
print("3. Exit")
n=int(input("\nSelect your choice : "))
if n==1:
self.readWriteFixedDeposit()
elif n==2:
self.readWriteRecurringDeposit()
elif n==3:
print("Thank You!!!")
exit()
else:
print("invalid option!\n try again\n")
self.bankOptions()
def readWriteFixedDeposit(self):
print("\nGive Fixed Deposit Details\n")
j=0
while(j==0):
try:
accountNumber = int(input("Enter Account Number: ").strip())
j=1
except:
print("Please try again")
name =input("Enter Account Name: ").strip()
j=0
while(j==0):
try:
duration = int(input("Duration: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
amount = float(input("Amount: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
rateOfInterest = float(input("Rate of Interest: ").strip())
j=1
except:
print("Please try again")
fd = FixedDeposit(accountNumber, name, duration, amount, rateOfInterest)
print("\nFixed Deposit Details are...\n")
print("\nAccount Number: ", fd.get_account_number())
print("Account Name: ", fd.get_name())
print("Duration: ", fd.get_duration())
print("Amount: ", fd.get_amount())
print("Rate of Interest: ", fd.get_rate_of_interest())
def readWriteRecurringDeposit(self):
print("\nGive Recurring Deposit Details\n")
j=0
while(j==0):
try:
accountNumber = int(input("Enter Account Number: ").strip())
j=1
except:
print("Please try again")
name =input("Enter Account Name: ").strip()
j=0
while(j==0):
try:
duration = int(input("Duration: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
monthlyPayment = float(input("Monthly Payment: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
rateOfInterest = float(input("Rate of Interest: ").strip())
j=1
except:
print("Please try again")
rd = RecurringDeposit(accountNumber, name, duration, monthlyPayment, rateOfInterest)
print("\nRecurring Deposit Details are...\n")
print("\nAccount Number: ", rd.get_account_number())
print("Account Name: ", rd.get_name())
print("Duration: ", rd.get_duration())
print("Monthly Payment: ", rd.get_monthly_payment())
print("Rate of Interest: ", rd.get_rate_of_interest())
def gotooptions(self):
if self.n!=3:
ch=input("\nDo you wish to continue(y/n)").strip()
if(ch[0]=='y' or ch[0]=='Y'):
BankDemo.bankOptions(self)
else:
print("Thank you!")
exit()
demoObject = BankDemo()
demoObject.bankOptions()
demoObject.gotooptions()