generated from github/codespaces-blank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATM_SYSTEM.py
44 lines (38 loc) · 1.22 KB
/
ATM_SYSTEM.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
class ATM:
def __init__(self, balance):
self.balance = balance
def check_balance(self):
print("Your current balance is:", self.balance)
def deposit(self, amount):
self.balance += amount
print("You have deposited:", amount)
print("Your updated balance is:", self.balance)
def withdraw(self, amount):
if amount > self.balance:
print("Insufficient balance")
else:
self.balance -= amount
print("You have withdrawn:", amount)
print("Your updated balance is:", self.balance)
atm = ATM(0)
while True:
print('CYPHA INC - ATM SYSTEM')
print("Welcome to Cypha-ATM")
print("1. Check balance")
print("2. Deposit")
print("3. Withdraw")
print("4. Exit")
choice = int(input("Enter your choice:\n"))
if choice == 1:
atm.check_balance()
elif choice == 2:
amount = int(input("Enter amount to deposit: "))
atm.deposit(amount)
elif choice == 3:
amount = int(input("Enter amount to withdraw: "))
atm.withdraw(amount)
elif choice == 4:
print("Thank you for using Cypha-ATM")
break
else:
print("Invalid choice, please try again")