Create a Python class named BankAccount which represents a bank account with the following attributes: numAccount, name (name of the owner of the account) and balance. 1. Create the constructor (__init__ method) 2. Create a method deposit() which manages payments. 3. Create a withdrawal() method that handles withdrawals. 4. Create a display() method that displays the details of the account 5. Create an instance of the class BankAccount and call the three methods defined.
class Bank_Account:
def __init__(self):
self.balance=0
print("Hello!!! Welcome to the Deposit & Withdrawal Machine")
def deposit(self):
amount=float(input("Enter amount to be Deposited: "))
self.balance += amount
print("\n Amount Deposited:",amount)
def withdraw(self)
amount = float(input("Enter amount to be Withdrawn: "))
if self.balance>=amount:
self.balance-=amount
print("\n You Withdrew:", amount)
else:
print("\n Insufficient balance ")
def display(self):
print("\n Net Available Balance=",self.balance)
s.deposit()
s.withdraw()
s.display()
Comments
Leave a comment