-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.py
50 lines (49 loc) · 1.62 KB
/
Customer.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
#Bank Application
import sys
class Customer:
'''Customer class of Bank Application'''
bankname='Rishabh Bank'
def __init__(self,name,city,balance=0.0):
self.name=name
self.city=city
self.balance=balance
def deposit(self,amount):
self.balance=self.balance+amount
print("Balance after deposit:",self.balance)
def withdraw(self,amount):
if amount<=self.balance:
self.balance=self.balance-amount
print("Balance after withdraw:",self.balance)
else:
print("Insufficient funds to withdraw!!")
def displayinfo(self):
print("Customer name:",self.name)
print("Customer city:",self.city)
print("Customer Balance:",self.balance)
print()
print("Welcome to",Customer.bankname)
c=Customer('Rishabh','Akola')
while True:
print("options are:\nd-deposit\nw-withdraw\nc-displayinfo\ne-exit\n")
print("Choose the option:")
option=input("Enter the option:").lower()
if option=='d':
amount=float(input("Enter amount to deposit:"))
c.deposit(amount)
elif option=='w':
while True:
amount=float(input("Enter amount in multiples of 100 to withdraw:"))
if not(amount>0 and amount%100==0):
print("Invalid amount!!")
break
else:
c.withdraw(amount)
break
elif option=='c':
print("Customer Details are:")
c.displayinfo()
elif option=='e':
print("Thank You for Banking with",Customer.bankname)
sys.exit(0)
else:
print("Invalid Option!!!")