0% found this document useful (0 votes)
29 views3 pages

MITU21BTCS0504 - Sahil Chalke Assignment - 10

This document contains code for an ATM machine simulation using classes and inheritance in Python. The AccountOperations class defines methods for checking balances, withdrawing amounts, depositing amounts, changing pins, and displaying mini statements. The Account class inherits from AccountOperations and implements these methods, with attributes to track the balance through transactions. The code demonstrates calling the methods on a bank object to simulate account functions like checking balances, withdrawals, deposits, pin changes, and displaying a mini statement.

Uploaded by

Shubham Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

MITU21BTCS0504 - Sahil Chalke Assignment - 10

This document contains code for an ATM machine simulation using classes and inheritance in Python. The AccountOperations class defines methods for checking balances, withdrawing amounts, depositing amounts, changing pins, and displaying mini statements. The Account class inherits from AccountOperations and implements these methods, with attributes to track the balance through transactions. The code demonstrates calling the methods on a bank object to simulate account functions like checking balances, withdrawals, deposits, pin changes, and displaying a mini statement.

Uploaded by

Shubham Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NAME : Sahil Chalke

CLASS : SY 3
ROLL NO : 2213172
ENROLLMENT NO : MITU21BTCS0504

Problem Statement 10 : (Classes)


Write a program to ATM machine operation utilizing classes,inheritance concepts for following

operations (Assume customer has savings bank account with respective bank):

a. Check Balance
b. Withdraw Amount
c. Deposit Amount
d. Mini Statement
e. Change Pin

Code :
class AccountOperations:

def check_balance(self):

pass

def withdraw(self):

pass

def deposit(self):

pass

def change_pin(self):

ac=[12345,23456,34567]

cn=int(input("Enter your account number :"))

for i in ac:

if cn in ac:

d=int(input("Enter your account number"))

break

else:

print("Account no.in not valid")

break

def display(self):
pass

class Account(AccountOperations):

def check_balance(self):

print("Account balance : ", self.balance)

def withdraw(self):

a=int(input("\nEnter the amount to be withdrawn : "))

if self.balance < a:

print("Amount to be withdrawn is greater than current balance ")

else:

self.balance1= self.balance-a

print("The current balance after withdrwal is :" ,self.balance1)

def deposit(self):

b=int(input("\nEnter the amount to be deposited : "))

self.balance2 = self.balance1 + b

print("The Account Balance after depositing is ",self.balance2)

def change_pin(self):

print("\n To change your atm pin ")

c = int(input("Enter your account number : "))

d = int(input("Enter your new 4 digit pin : "))

def display(self):

print("\n\n The MINI STATEMENT is :")

print("The starting account balance : ",self.balance)

print("The balance after withdrwal is : " ,self.balance1)

print("The balance after depositing is : " ,self.balance2)

print("The final Account balance is : ",self.balance2)

bank = Account()
bank.balance= 100000

bank.balance1 = 0

bank.balance2 = 0

bank.check_balance()

bank.withdraw()

bank.deposit()

bank.change_pin()

bank.display()

Output :

You might also like