-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllUser.py
60 lines (49 loc) · 1.96 KB
/
AllUser.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
from Information_of_bank import *
class Person:
def __init__(self, name, email, address, phone) -> None:
self.name = name
self.email = email
self.address = address
self.phone = phone
self.information = Information()
class User(Person):
def __init__(self, name, email, address, phone, initial_balance) -> None:
super().__init__(name, email, address, phone)
self.initial_balance = initial_balance
self.loan = None
self.history = []
self.my_balance = initial_balance
def deposit(self, amount):
if amount > 0:
self.initial_balance += amount
self.my_balance += amount
str = f"Deposited ${amount}"
self.history.append(str)
else:
print('You have to give some money for deposit')
def withdraw(self, amount):
if 0 < amount <= self.information.max_withdraw and self.information.min_withdraw <= amount <= self.initial_balance:
self.initial_balance -= amount
self.my_balance -= amount
str = f"Withdraw ${amount}"
self.history.append(str)
else:
print('Invalid withdrawal amount or insufficient funds.')
def see_history(self):
print(f'Name : {self.name}')
print()
print("History:")
for his in self.history:
print(his)
def check_balance(self):
print(f'hey! {self.name}. Your balanace is : {self.my_balance}')
def transfer(self, recipient, amount):
if 0 < amount <= self.initial_balance:
self.initial_balance -= amount
for key, value in self.information.List_of_user.items():
if key == recipient:
value.initial_balance += amount
class Employee(Person):
def __init__(self, name, email, address, phone, type_of_work) -> None:
super().__init__(name, email, address, phone)
self.type_of_work = type_of_work