-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathclasses.py
189 lines (133 loc) · 4.24 KB
/
classes.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
__author__ = 'user'
from abc import ABC,abstractmethod
class Customer():
def set_first_name(self,fname):
self.first_name = fname
def set_last_name(self,lname):
self.last_name = lname
def set_customer_id(self,id):
self.customer_id = id;
def set_password(self,pwd):
self.password = pwd
def set_login_attempts(self,att):
self.login_attempts = att
if att == 0:
self.status = "locked"
def set_status(self,status):
self.status = status
def set_address(self,addr):
self.addr = addr
def get_first_name(self):
return self.first_name
def get_last_name(self):
return self.last_name
def get_customer_id(self):
return self.customer_id
def get_password(self):
return self.password
def get_login_attempts(self):
return self.login_attempts
def get_status(self):
return self.status
def get_addr_line1(self):
return self.addr.line1
def get_addr_line2(self):
return self.addr.line2
def get_addr_city(self):
return self.addr.city
def get_addr_state(self):
return self.addr.state
def get_addr_pincode(self):
return self.addr.pincode
class Account(ABC):
def set_account_no(self,acc_no):
self.account_no = acc_no
def set_account_type(self,type):
self.type = type
def set_balance(self,bal):
self.balance = bal
def set_withdrawals_left(self,wd):
self.withdrawals_left = wd
def get_account_no(self):
return self.account_no
def get_balance(self):
return self.balance
def get_account_type(self):
return self.type
def get_withdrawals_left(self):
return self.withdrawals_left
class Savings(Account):
interest = 7.5;
min_balance = 0;
def open_account(self,amount):
if amount < 0:
print("Please input a valid amount")
return False
else:
self.balance = amount
return True
def deposit(self,amount):
if amount < 0:
print("Please input a valid amount");
return False
else:
self.balance += amount;
return True
def withdraw(self,amount):
if amount > self.balance:
print("Sorry You don't have enough balance");
return False
else:
self.balance -= amount;
return True
class Current(Account):
interest = 0
min_balance = 5000
def open_account(self,amount):
if amount < self.min_balance:
print("Please input a valid amount")
return False
else:
self.balance = amount
return True
def deposit(self,amount):
if amount < 0:
print("Please input a valid amount");
return False
else:
self.balance += amount;
return True
def withdraw(self,amount):
if amount > self.balance:
print("Sorry You don't have enough balance");
return False
elif self.balance - amount < 5000:
print("Sorry You can't withdraw this much money as you need at least Rs",self.min_balance," to maintain this account")
return False
else:
self.balance -= amount;
return True
class Fixed_Deposit(Account):
min_balance = 1000
def open_account(self,amount):
if amount < self.min_balance:
print("Please input a valid amount")
return False
else:
self.balance = amount
return True
def set_deposit_term(self,term):
self.deposit_term = term
def get_deposit_term(self):
return self.deposit_term
class Address():
def set_line_1(self,line1):
self.line1 = line1
def set_line_2(self,line2):
self.line2 = line2
def set_city(self,city):
self.city = city
def set_state(self,state):
self.state = state
def set_pincode(self,pincode):
self.pincode = pincode