0% found this document useful (0 votes)
31 views29 pages

Bank Management System

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)
31 views29 pages

Bank Management System

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/ 29

BANK MANAGEMENT SOFTWARE

INDEX
Sr. No Particular
1 Brief overview of project
2 Software and hardware requirement
3 Structure of the tables
4 Source code of project
5 Output screening
6 Bibliography

Project Idea: Bank Management System


Brief overview of project
The Bank Management System is a Python-based application that
serves as a comprehensive solution for managing bank accounts
and related operations. This system is designed to provide a user-
friendly interface for both customers and administrators to
interact with the bank's database efficiently. The application
utilizes MySQL as the database management system for secure
storage and retrieval of account information.
Key Features of Bank Account Management System
Before you start designing your program, it's crucial to have a
clear understanding of the problem you're trying to solve. Let's
revisit the key features of our Bank Account Management System:
User Authentication
 Users must log in with their account number and password
to access their accounts.
 Passwords are securely stored in the database using hashing
techniques.
Customer Operations
 Customers can check their account balance.
 Customers can deposit funds into their accounts.
 Customers can withdraw funds from their accounts.
 Customers can transfer funds to other accounts within the
bank, ensuring convenient money transfers.
 Customers can change their account passwords for security
purposes.
Admin Operations
 Administrators can log in with a special password to access
admin features.
 Admins can create new customer accounts.
 Admins can update customer account details, including their
balance.
 Admins can delete customer accounts.
 Admins can search for customer accounts by account
number or account holder's name.
 Admins can view a list of all customer accounts.
How To Code The Project
To make your project organized and manageable, it's essential to
divide your code into smaller functions, each with a specific
purpose and responsibility.
Begin with the most basic functionalities, Once these are working,
gradually add more features. Don't hesitate to ask for help or
guidance from instructors, classmates, or online communities. If
you find making this project is too complex, this sample
project might be useful for you.
Prerequisites
Before you begin, make sure you have the following installed:
Python: Download Python
MySQL: Download MySQL
mysql-connector-python: install it using pip
pip install mysql-connector-python

Software and hardware requirement:


Technologies Used:

SOFTWARE SPECIFICATION:-
Operating System : Windows 7
Platform : Python IDLE 2.7
Database : MySQL
Languages : Python

HARDWARE SPECIFICATION:-

Processor : Dual Core and above


Hard Disk : 40GB
Ram : 1024 MB
Data file handling has been effectively used in the program. The database is a
collection of interrelated data to serve multiple applications. That is database
programs create files of information. So we see that files are worked with most,
inside the program.

DBMS: The software required for the management of data is called as DBMS.
It has3 models:

• Relation model

• Hierarchical model

• Network model

RELATIONAL MODEL: It’s based on the concept on relation. Relation is the


table that consists of rows and columns. The rows of the table are called tuple
and the columns of the table are called attribute. Numbers of rows in the table is
called as cardinality. Number of columns in the table is called as degree.

HIERARCHICAL MODEL: In this type of model, we have multiple records for


each record. A particular record has one parent record. No chide record can
exist without parent record. In this, the records are organized in tree.

NETWORK MODEL: In this, the data is represented by collection of records


and relationship is represented by (ink or association.
CHARACTERISTICS OF DBMS:
• It reduces the redundancy
• Reduction of data in inconsistency
• Data sharing
• Data standardization
DIFFERENT TYPES OF FILES: -BASED ON ACCESS:
• Sequential file
• Serial file
• Random (direct access) file BASED ON STORAGE:-
• Text file
• Binary File

structure of a tables:
python code:

source code:

# create table customer (custid bigint primary key,account_no bigint ,name


varchar(20),gender char,address varchar(20));

#create table login (custid bigint ,password varchar(20),foreign key login(custid)


references customer(custid));

#create table transaction (custid bigint,tid bigint primary key


auto_increment,time_trans datetime);

# alter table transaction auto_increment=1

import random

import datetime

def change_password():

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

while(True):

custid=int(input("enter the custid"))

pwd=input(" enter the old password")

qry="select * from login where custid={}".format(custid)

cur.execute(qry)

data=cur.fetchall()

print(data)
if data[0][1]==pwd:

passnew=input(" enter the new password")

qry="update login set password='{}' where


custid={}".format(passnew,custid)

cur.execute(qry)

mycon.commit()

print("password successfully updated")

break

cho=input(" do you want to try again? press y/n")

if cho.lower()=='n':

break

mycon.close()

def account_balance():

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account number"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)

cur.execute(qry)
data=cur.fetchone()

if data==None:

print("invalid input")

else:

work_done="check_balance"

print(" Account type:",data[1])

print(" Account balance",data[2])

qry="insert into transaction (custid,time_trans,work_done) values


({},'{}','{}')".format(custid,datetime.datetime.now(),work_done)

cur.execute(qry)

mycon.commit()

def deposit():

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account number"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)

cur.execute(qry)

data=cur.fetchone()
if data==None:

print("invalid input")

else:

amt=int(input(" enter the amount to get deposited"))

work_done="deposit"

qry="update account set balance=balance+{} where account_no={} and


account_type='{}'".format(amt,acc_no,acc_type)

cur.execute(qry)

mycon.commit()

qry="insert into transaction (custid,time_trans,work_done) values


({},'{}','{}')".format(custid,datetime.datetime.now(),work_done)

cur.execute(qry)

mycon.commit()

def withdraw():

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account number"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)
cur.execute(qry)

data=cur.fetchone()

if data==None:

print("invalid input")

else:

amt=int(input(" enter the amount to withdraw"))

work_done="withdraw"

qry="update account set balance=balance-{} where account_no={} and


account_type='{}'".format(amt,acc_no,acc_type)

cur.execute(qry)

mycon.commit()

qry="insert into transaction (custid,time_trans,work_done) values


({},'{}','{}')".format(custid,datetime.datetime.now(),work_done)

cur.execute(qry)

mycon.commit()

def transfer_fund():

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account number"))


acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)

cur.execute(qry)

data=cur.fetchone()

if data==None:

print("invalid input")

else:

amt=int(input(" enter the amount to deposit"))

acc=int(input("enter the account number to which the amount to be


transfered"))

type1=input("enter the account type")

work_done="Fund transfer"

try:

qry="update account set balance=balance+{} where account_no={} and


account_type='{}'".format(amt,acc,type1)

cur.execute(qry)

mycon.commit()

qry="update account set balance=balance-{} where account_no={} and


account_type='{}'".format(amt,acc_no,acc_type)

cur.execute(qry)
mycon.commit()

qry="insert into transaction (custid,time_trans,work_done) values


({},'{}','{}')".format(custid,datetime.datetime.now(),work_done)

cur.execute(qry)

mycon.commit()

except:

print("error in transaction")

def CREATE_ACCOUNT():

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

cur=mycon.cursor()

name=input("Customer Name:")

gender=input("Gender:m/f")

address=input("Address:")

ini_dept=int(input("initial amount for opening account"))

acc_type=input("enter the account type")

qry="select max(custid) from customer"


cur.execute(qry)

data=cur.fetchone()

print(data)

if data[0]==None:

custid=9876

else:

custid=data[0]+1

qry="select max(account_no) from customer"

cur.execute(qry)

data=cur.fetchone()

print(data)

if data[0]==None:

account_no=123456789

else:

account_no=data[0]+1

qry="insert into customer (custid,account_no,name,gender,address) values({},


{},'{}','{}','{}')".format(custid,account_no,name,gender,address)

cur.execute(qry)

mycon.commit()
password=name[:4]+gender+str(random.randint(1000,10000))

qry="insert into login (custid,password,acc_no) values({},'{}',


{})".format(custid,password,account_no)

cur.execute(qry)

mycon.commit()

qry="insert into account (account_no,account_type,balance) values({},'{}',


{})".format(account_no,acc_type,ini_dept)

cur.execute(qry)

mycon.commit()

print("new CUSTOMER id",custid)

print("new CUSTOMER ACCOUNT",account_no)

print("new CUSTOMER password",password)

def UPDATE_ACCOUNT():

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account no"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)
cur.execute(qry)

data=cur.fetchone()

if data==None:

print("invalid input")

else:

cho=int(input("Enter1-change account\n2.Add Bonus"))

if cho==1:

if acc_type=="saving":

acc_type="current"

else:

acc_type="saving"

qry="update account set account_type='{}' where


account_no={}".format(acc_type,acc_no)

cur.execute(qry)

else:

bonus=int(input("enter the bonus amount"))

qry="update account set balance=balance+{} where


account_no={}".format(bonus,acc_no)

cur.execute(qry)

mycon.commit()
def DELETE_ACCOUNT():

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account no. to be deleted"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)

cur.execute(qry)

data=cur.fetchone()

if data==None:

print("invalid input")

else:

custid=int(input("enter the custid"))

qry="delete from login where custid={}".format(custid)

cur.execute(qry)

mycon.commit()

qry="delete from account where account_no={}".format(acc_no)

cur.execute(qry)

mycon.commit()
def SEARCH_ACCOUNT():

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

cur=mycon.cursor()

acc_no=int(input("enter the account no"))

acc_type=input("enter account type")

qry="select * from account where account_no={} and


account_type='{}'".format(acc_no,acc_type)

cur.execute(qry)

data=cur.fetchone()

if data==None:

print("invalid input")

else:

print(data)

mycon.commit()

def VIEW_ALL_ACCOUNT():

print("\n*******ACCOUNT DETAILS********\n")

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

cur=mycon.cursor()

qry="select * from account"


cur.execute(qry)

data=cur.fetchall()

for i in data:

print(i)

import mysql.connector

mycon=mysql.connector.connect(host="localhost",user="root",passwd="root",dat
abase="bankmgnt")

mycursor=mycon.cursor()

while True:

print("1.ADMIN LOGIN\n2.CUSTOMER LOGIN\n3.QUIT")

choice=int(input("ENTER YOUR CHOICE"))

if choice==1:

uid=int(input(" enter the Admin_id"))

password=input("enter the Password")

if uid==999 and password=="admin":

while(True):

print("\n1.CREATE ACCOUNT\n2.UPDATE ACCOUNT\n3.DELETE


ACCOUNT\n4.SEARCH ACCOUNT\n5.VIEW ALL ACCOUNT\n6.LOGOUT")

cho=int(input("ENTER YOUR CHOICE"))

if cho==1:

CREATE_ACCOUNT()#ok
elif cho==2:

UPDATE_ACCOUNT()

elif cho==3:

DELETE_ACCOUNT()#ok

elif cho==4:

SEARCH_ACCOUNT()#ok

elif cho==5:

VIEW_ALL_ACCOUNT()#ok

elif cho==6:

break

else:

print(" Mr.Admin entered uid or password is incorrect")

elif choice==2:

mycon=mysql.connector.connect(host="localhost",user="root",password="root",d
atabase="bankmgnt")

cur=mycon.cursor()

while(True):

flag=0

custid=int(input("enter the custid"))

pwd=input(" enter the old password")

qry="select * from login where custid={}".format(custid)

cur.execute(qry)
data=cur.fetchall()

print(data)

if data[0][1]==pwd:

while(True):

choice=int(input("1-account_balance\n2.deposit\n3.withdraw\
n4.transfer_fund\n5.change_password\n6 exit"))

if choice==1:

account_balance()#ok

elif choice==2:

deposit()#ok

elif choice==3:

withdraw()#ok

elif choice==4:

transfer_fund()#ok

elif choice==5:

change_password()#ok

else:

flag=1

break

else:

break
if flag==1:

break

elif choice==3:

break

output screen
enter the account number123456791

enter account typecurrent

enter the amount to get deposited1200

1-account_balance

2.deposit

3.withdraw

4.transfer_fund

5.change_password

6 exit1

enter the account number123456791

enter account typecurrent

Account type: current

Account balance 7200

1-account_balance

2.deposit

3.withdraw

4.transfer_fund

5.change_password

6 exit4

enter the account number123456791

enter account typecurrent

enter the amount to deposit1400


enter the account number to which the amount to be transfered123456790

enter the account typesaving

1-account_balance

2.deposit

3.withdraw

4.transfer_fund

5.change_password

6 exit1

enter the account number23456791

enter account typecurrent

invalid input

1-account_balance

2.deposit

3.withdraw

4.transfer_fund

5.change_password

6 exit1

enter the account number123456791

enter account typecurrent

Account type: current

Account balance 5800

1-account_balance
2.deposit

3.withdraw

4.transfer_fund

5.change_password

6 exit

BIBLIOGRAPHY

1. http://www.google.com/

2. http://en.wikipedia.org

3. Computer science with python

by Sumita Arora

You might also like