-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankSystem.py
More file actions
53 lines (50 loc) · 1.59 KB
/
Copy pathBankSystem.py
File metadata and controls
53 lines (50 loc) · 1.59 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
class User():
def __init__(self,nama,umur,gender):
self.nama = nama
self.umur = umur
self.gender = gender
def ShowInfo(self):
print(self.nama)
print(self.umur)
print(self.gender)
class Bank(User):
def __init__(self,nama,umur,gender):
super().__init__(nama,umur,gender)
self.balance = 0
self.history = []
def deposit(self,amount):
self.balance = self.balance + amount
print('account balance has been update=', self.balance)
def withdraw(self,amount):
if amount < self.balance:
self.balance = self.balance - amount
print('account balance has been update=', self.balance)
else:
print('you cant withdraw')
def view_balance(self):
self.ShowInfo()
print('account balance has been update=', self.balance)
def histori(self):
for i in self.history:
print(i)
nama = input('Masukan usernama=')
umur = input('Masukan umur=')
gender = input('Masukan gender=')
user = Bank(nama,umur,gender)
while True:
options = int(input('1. details\n2. deposit\n3. withdraw\n4. view balance\n5. History\n6. Exit\n''))
if options == 1:
user.ShowInfo()
elif options == 2:
dep = int(input('Masukan jumlah deposit='))
user.deposit(dep)
elif options == 3:
draw = int(input('Masukan jumlah withdraw='))
user.withdraw(draw)
elif options ==4:
user.view_balance()
elif options == 5:
user.histori()
elif options ==6:
print('exit')
break