1
Introduction :-
“Bank Management System “ This project is
useful for the bank employees as well as
customers to keep a track of account details. The
emerging digital system made information
available on fingertips. By automating the
transaction one can view the details as and when
required in no time. This project emphases on
creation of new customer accounts , managing
the existing account holders in the bank by
making digital system once can generate daily
reports, monthly reports and annual reports
which can enhance the system.
                                                      2
Objectives of the project :-
The objective of this project is to let the student
apply the programming knowledge into a real
world situation and exposed the students how
programming skills help in developing a good
software.
  1.Write programs utilizing modern software
    tools
  2.Apply object – oriented programming
    principles effectively when developing small
    to medium sized projects.
  3.Write effective procedal code to solve small
    to medium sized problems
  4.Students will demonstrate a breadth of
    knowledge in computer science, as
    exemplified in the areas of systems , theory
    and software development.
                                                   3
Source Code :-
import pickle
import os
import pathlib
class Account :
accNo = 0
name = “
deposit =0
type = “
def createAccount ( self ):
self.accNo = int (input(“ Enter the account no :
”))
self.name = input(“Enter account holder name :
”)
self.type = input (“Enter the type of
account[c/s] : ”)
                                                     4
self.deposit = int(input(“Enter the initial amount
(>=500 for saving and >=1000 for current”))
print(“\n\n\nAccount Created “)
def showAccount (self) :
print(“Account Number : “, self.accNo)
print(“Account Holder Name : “,self.name)
print(“Type of Acccount “,self.type)
print(“Balance : “,self.deposit)
def modifyAccount(self) :
print(“Account Number :”,self.accNo)
self.name = input( “Modify Account Holder Name
:”)
self.type = input(“ Modify type of Account :”)
self.deposit = int(input(“Modify Balance : ”))
                                                      5
def depositAmount(self,amount):
self.deposit += amount
def withdrawAmount (self,amount):
self.deposit -= amount
def report (self):
print (self.accNo,” ”, self.name , “ ”, self.type,”
”,self.deposit)
def getAccountNo(self):
return self.accNo
def getAccountHolderName(self):
return self.name
def getAccountType(self):
return self.type
def getDeposit(self):
                                               6
return self.deposit
def intro():
print(“\t\t\t\t***************************”)
print(“\t\t\t\tBANK MANAGEMENT SYSTEM”)
print(“\t\t\t\t***************************”)
input()
def writeAccount():
account = Account()
account.createAccount()
writeAccountsFile(Account)
def displayAll():
file = pathlib.path(“account.data”)
if file.exists ():
infile = open (‘accounts.data’,’rb’)
                                                    7
mylist = pickle.load(infile)
for item in mylist :
print(item.accNo,” ”, item.name, “ ”, item.type,”
”,item.deposit)
infile.close()
else:
print(“No records to display”)
def displays(num):
file = pathlib.path(“ accounts.data”)
if file.exists ():
infile = open (‘accounts.data’,’rb’)
mylist = pickle.load(infile)
infile.close()
found = false
for item in mylist :
if item.accNo == num:
                                                   8
print (“your account balance is =”,item.deposit)
found = true
else :
print (“”no records to search”)
if not found :
print (“No existing record with this number”)
def depositAndWithdraw(num1,num2):
file = pathlib.path(“accounts.data”)
if file.exists ():
infile = open (‘accounts.data’,’rb’)
mylist = pickle.load(infile)
infile.close()
os.remove (‘accounts.data’)
for item in mylist :
if item .accNo ==num1:
if num2 == 1:
                                                9
amount = int(input(“Enter the amount to
deposit : “))
item.deposit += amount
print (“Your account is updated”)
elif num2 ==2:
amount = int(input(“Enter the amount to
withdraw :”))
if amount <= item.deposit:
item.deposit-=amount
else :
print (“You cannot withdraw larger amount”)
else:
print(“No records to search”)
outfile = open (‘newaccounts.data’,’wb’)
pickle.dump(mylist, outfile)
outfile.close()
os.rename(‘newaccounts.data’,’accounts.data’)
                                                10
def deleteAccount(num):
file = pathlib.path(“accounts.data”)
if file.exists ():
infile = open(‘accounts.data’,’rb’)
oldlist = pickle.load(infile)
infile.close()
newlist[]
for item in oldlist:
if item.accNo != num:
newlist.append(item)
os.remove(‘accounts.data’)
outfile = open(‘newaccounts.data’,’wb’)
pickle.dump(newlist,outfile)
outfile.close()
os.rename(‘newaccounts.data’,’accounts.data’)
def modifyAccount(num):
file = pathlib.path (“accounts.data”)
                                                   11
if file.exists():
infile = open(‘accounts.data’,’rb’)
oldlist = pickle.load(infile)
infile.close()
os.remove(‘accounts.data’)
for item in oldlist:
if item.accNo == num
item.name = input (“Enter the account holder
name : ”)
item.type = input (“Enter the account type : ”)
item.deposit = int(input(“Enter the amount : ”))
outfile = open(‘newaccounts.data’,’wb’)
pickle.dump (oldlist,outfile)
outfile.close ()
os.rename(‘newaccounts.data’, ‘accounts.data’)
def writeAccountsFile(account) :
                                                12
file = pathlib.path (“accounts.data”)
if file.exists ():
infile = open (‘accounts.data’,’rb’)
oldlist = pickle.load(infile)
oldlist.append(account)
infile.close()
os.remove(‘accounts.data’)
else:
oldlist = [account]
outfile = open (‘newaccounts.data’,’wb’)
pickle.dump (oldlist, outfile)
outfile.close()
os.rename(‘newaccounts.data’,’accounts.data’)
#start of the program
Ch=’’
                                        13
Num=0
Intro()
While ch !=8
#system(“cls”);
print(“\tMAIN MENU”)
print(“\t1. NEW ACCOUNT”)
print(“\t2. DEPOSIT AMOUNT”)
print(“\t3. WITHDRAW AMOUNT”)
print(“\t4. BALANCE ENQUIRY”)
print(“\t5. ALL ACCOUNT HOLDER LIST”)
print(“\t6. CLOSE AN ACCOUNT”)
print(“\t7. MODIFY AN ACCOUNT”)
print(“\t8. EXIT”)
print(“\tSelect your option (1-8)”)
ch = input()
#system(“cls”);
                                                14
if ch == ‘1’:
writeAccount()
elif ch == ‘2’:
num = int (input(“\tEnter the account no :”))
depositAndWithdraw(num,1)
elif ch ==’3’:
num = int(input(“\tEnter the account no :”))
depositAndWithdraw(num,2)
elif ch == ‘4’:
num = int(input(“\tEnter the account no: ”))
displaysp(num)
elif ch ==’5’
displayAll();
elif ch==’6’
num=int(input(“\tEnter The account no. :”))
deleteAccount(num)
elif ch==’7’
                                              15
num=int(input(“\tEnter The account no. :”))
modifyAccount(num)
elif ch==’8’:
print(“\tTnanks for using bank management
system”)
break
else:
print(“Invalid choice”)
ch=input(“Enter your choice: “)