-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsum.py
81 lines (68 loc) · 2.33 KB
/
sum.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
# lets make software for atm machine
class Atm():
def __init__(self):
self._balance = 0 # declare variable or attribute
self._pin = ''
# constructor ahe: __init__()
# self.menu()
def menu(self):
user_input = input('''
Welcome to Atm
how would you like to proceed?
Enter 1 for Generate/create pin
Enter 2 for Deposite money
Enter 3 for withdraw money
Enter 4 for check the balance
Enter 5 to exist
''')
if user_input == '1':
self.create_pin()
elif user_input == '2':
self.deposite()
elif user_input == '3':
self.withdraw()
elif user_input == '4':
self.check_balance()
elif user_input == '5':
self.exist()
def create_pin(self):
self._pin = input("enter your new pin:")
print("your Atm pin set successfully.......")
def get_pin(self): # getter method
return self._pin
def set_pin(self): # setter method
new_pin = input("enter your new pin ...:")
if type(new_pin) == str:
self._pin = new_pin
print('pin set succesfully...')
def deposite(self):
temp = input("enter ATM pin : ")
if temp == self._pin:
amount = int(input("enter amount : "))
self._balance = self._balance + amount
print("Deposite sucessful...!")
else:
print("Wrong pin.....!")
def withdraw(self):
temp = input("enter ATM pin : ")
if temp == self._pin:
amount = int(input("enter Amount :"))
if amount < self._balance:
self._balance = self._balance - amount
print("withdraw sucessfully.....!")
else:
print('insufficient Balance in your accound....!')
else:
print("invalid pin")
def check_balance(self):
temp = input("enter ATM pin : ")
if temp == self._pin:
print("your balance is :", self._balance)
else:
print("invalid pin")
def exist(self):
print("Exist sucessfully")
sbi = Atm()
# sbi.create_pin()
# sbi.deposite()
# id(sbi)