0% found this document useful (0 votes)
18 views23 pages

Harshita

Uploaded by

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

Harshita

Uploaded by

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

SOURCE CODE

# project for the submission of CBSE BOARD EXAM


#project done by COMPUTER students of SCHOLARS ROSARY SCHOOL
# THIS IS THE PROJECT FOR TRANSACTIONS IN INDIAN BANK

# importing header files.


import mysql.connector as sc
import matplotlib.pyplot as plt
import numpy as np

#function definition for home page.


def homepage():
print("\n\n\n")
print("####################################################")
print("WELCOME TO INDIAN BANK ")
print("####################################################")
print("HOME PAGE MENU")
print("1. USER ACCOUNT CREATION")
print("2. UPDATE ACCOUNT DETAILS")
print("3. TRANSACTIONS")
print("4. SEARCH DETAILS")
print("5. REMOVE USER DETAILS")
print("6. REPORT ")
print("###################################################")
op=int(input("Enter your option"))
if op==1:
accountcreation()
elif op==2:
updatedetails()
elif op==3:
transaction()
elif op==4:
search()
elif op==5:
remove()
elif op==6:
report()
else:
print("Invalid option")
print("###################################################")

# Function definition for login


def login():
print("\n\n\n")
print("##############################################")
print("WELCOME TO INDIAN BANK LOGIN SECTION")
print("#################################################")
user=input("Enter your user ID :")
pas=input("Enter your password:")
if user=="root" and pas=="admin":
print("############################")
print("SUCCESSFULLY LOGGED!!!!!")
homepage()
else:
print("INCORRECT CREDENTIALS")
login()

#function defition for account creation.


def accountcreation():
print("\n\n\n")
print("WELCOME TO INDIAN BANK")
print("######################")
print("HAPPY TO KNOW THAT YOU ARE STARTING ACCOUNT HERE")
print("ENTER USER DETAILS")
print("#############################")
b_accno=input("Enter Account No:")
b_name=input("Enter USer name :")
b_bname=input("Enter branch name:")
b_type=input("Enter Type of Account:")
b_amount=int(input("Enter starting balance:"))
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="insert into bank
values('{}','{}','{}','{}',{})".format(b_accno,b_name,b_bname,b_type,b_amount)
mycursor.execute(query1)
conn.commit()
conn.close()
print("SUCCESSFUULY CREATE NEW ACCOUNT !!!!")

# function definition for update account details


def updatedetails():
u_accno=input("Enter the account number of the user we want to update ")
u_name=input("Enter correct name:")
u_bname=input("Enter correct branch name :")
u_type=input("Enter correct type of account")
u_amount=int(input("Enter correct amount:"))
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="update bank set accname='{}',brname='{}',atype='{}',bamount={} where
accno='{}'".format(u_name,u_bname,u_type,u_amount,u_accno)
mycursor.execute(query1)
conn.commit()
conn.close()
print("SUCCESSFUULY UPDATE ACCOUNT DETAILS !!!!")

#function defintion for transactions:


def transaction():
print("\n\n\n")
print("######################################")
print("WELCOME TO INDIAN BANK")
print("1. DEPOSIT")
print("2. WITHDRAW")
print("3. BALANCE ENQUIRY")
print("4. GO TO MAIN PAGE")
op=int(input("Enter your option:"))
if op==1:
d_accno=input("Enter you account number")
d_amount=int(input("Enter the amount you want to deposit"))
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="update bank set bamount=bamount+{} where
accno='{}'".format(d_amount,d_accno)
mycursor.execute(query1)
conn.commit()
conn.close()
print("SUCCESSFUULY CREDIT THE AMOUNT TO YOUR ACCOUNT !!!!")
elif op==2:
d_accno=input("Enter you account number")
d_amount=int(input("Enter the amount you want to withdraw"))
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="update bank set bamount=bamount-{} where
accno='{}'".format(d_amount,d_accno)
mycursor.execute(query1)
conn.commit()
conn.close()
print("SUCCESSFUULY WITHDRAW THE AMOUNT FROM YOUR ACCOUNT
!!!!")
elif op==3:
u_accno=input("Enter the account number of the user we want to search")
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="select accno,accname,bamount from bank where accno='{}'".format(u_accno)
mycursor.execute(query1)
myrecord=mycursor.fetchall()
for x in myrecord:
print(x)
conn.close()
print("SUCCESSFUULY DISPLAY THE BALANCE DETAILS !!!!")
elif op==4:
homepage()
else:
print("INVALID OPTION")

# function definition for search account details


def search():
u_accno=input("Enter the account number of the user we want to search")
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="select * from bank where accno='{}'".format(u_accno)
mycursor.execute(query1)
myrecord=mycursor.fetchall()
for x in myrecord:
print(x)
conn.close()
print("SUCCESSFUULY DISPLAY THE ACCOUNT DETAILS !!!!")

#function definition to remove an account


def remove():
u_accno=input("Enter the account number of the user we want to remove")
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="delete from bank where accno='{}'".format(u_accno)
mycursor.execute(query1)
conn.commit()
conn.close()
print("SUCCESSFUULY REMOVE THE ACCOUNT DETAILS !!!!")

#Function definition for Report


def report():
print("\n\n\n")
print("#######################################")
print("WELCOME TO INDIAN BANK ")
print("#######################################")
print("REPORT SECTION ")
print("1. REPORT BASED ON TYPE OF ACCOUNT")
print("2. REPORT BASED ON AMOUNT DEPOSITED")
print("3. REPORT BASED ON LOCATION")
print("4. GO TO HOME PAGE")
op=int(input("Enter your option:"))
if op==1:
print("\n\n\n\n")
print("##########################")
print("WELCOME TO INDIAN BANK ")
print("REPORT SECTION")
nlist=[]
xar=np.arange(1,5)
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
type1="Saving"
type2="Current"
type3="Business"
type4="Loan"
query1="select count(*) from bank where atype='{}'".format(type1)
query2="select count(*) from bank where atype='{}'".format(type2)
query3="select count(*) from bank where atype='{}'".format(type3)
query4="select count(*) from bank where atype='{}'".format(type4)
mycursor.execute(query1)
myrecord1=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query2)
myrecord2=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query3)
myrecord3=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query4)
myrecord4=mycursor.fetchall()
conn.close()
for x in myrecord1:
nlist.append(x[0])
for x in myrecord2:
nlist.append(x[0])
for x in myrecord3:
nlist.append(x[0])
for x in myrecord4:
nlist.append(x[0])
print(nlist)
plt.bar(xar,nlist,width=0.5,color=["red","green","blue","yellow"])
plt.xlabel("Type of account")
plt.ylabel("No of account holders")
plt.title("BAR GRAPH ON TYPE OF ACCOUNT ANALYSIS")
xnames=["Saving","Current","Business","Loan"]
plt.xticks(xar,xnames,rotation=30)
elif op==2:
print("\n\n\n\n")
print("##########################")
print("WELCOME TO INDIAN BANK ")
print("REPORT SECTION BASED ON AMOUNT DEPOSITED")
nlist=[]
xar=np.arange(1,5)
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
query1="select count(*) from bank where bamount<500"
query2="select count(*) from bank where bamount>=500 and bamount<=50000"
query3="select count(*) from bank where bamount>50000 and bamount<=100000"
query4="select count(*) from bank where bamount>100000"
mycursor.execute(query1)
myrecord1=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query2)
myrecord2=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query3)
myrecord3=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query4)
myrecord4=mycursor.fetchall()
conn.close()
for x in myrecord1:
nlist.append(x[0])
for x in myrecord2:
nlist.append(x[0])
for x in myrecord3:
nlist.append(x[0])
for x in myrecord4:
nlist.append(x[0])
print(nlist)
plt.bar(xar,nlist,width=0.5,color=["red","green","blue","yellow"])
plt.xlabel("AMOUNT RANGE ")
plt.ylabel("No of account holders")
plt.title("BAR GRAPH ON AMOUNT DEPOSITED ANALYSIS")
xnames=["<500","500-50000","50000-100000",">100000"]
plt.xticks(xar,xnames,rotation=30)
elif op==3:
print("\n\n\n\n")
print("##########################")
print("WELCOME TO INDIAN BANK ")
print("REPORT SECTION")
nlist=[]
xar=np.arange(1,5)
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
type1="Trivandrum"
type2="Kollam"
type3="Cochin"
type4="Kozhikode"
query1="select count(*) from bank where brname='{}'".format(type1)
query2="select count(*) from bank where brname='{}'".format(type2)
query3="select count(*) from bank where brname='{}'".format(type3)
query4="select count(*) from bank where brname='{}'".format(type4)
mycursor.execute(query1)
myrecord1=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query2)
myrecord2=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query3)
myrecord3=mycursor.fetchall()
conn.close()
conn=sc.connect(host="localhost",user="root",password="admin",database="ip12")
mycursor=conn.cursor()
mycursor.execute(query4)
myrecord4=mycursor.fetchall()
conn.close()
for x in myrecord1:
nlist.append(x[0])
for x in myrecord2:
nlist.append(x[0])
for x in myrecord3:
nlist.append(x[0])
for x in myrecord4:
nlist.append(x[0])
print(nlist)
plt.bar(xar,nlist,width=0.5,color=["red","green","blue","yellow"])
plt.xlabel("LOCATION")
plt.ylabel("No of account holders")
plt.title("BAR GRAPH ON LOCATION ANALYSIS")
xnames=["Trivandrum","Kollam","Cochin","Kozhikode"]
plt.xticks(xar,xnames,rotation=30)

elif op==4:
homepage()
else:
print("INVALID OPTION")

#CALLING MAIN SECTION


login()
OUTPUT
LOGIN SECTION & HOME PAGE
ACCOUNT OPENING

UPDATE ACCOUNT DETAILS


TRANSACTIONS(DEPOSIT)

TRANSACTIONS(WITHDRAW)
TRANSACTIONS(BALANCE ENQUIRY)

SEARCH USER DETAILS


REMOVE USER DETAILS
REPORT BASED ON TYPE OF ACCOUNT
REPORT BASED ON AMOUNT DEPOSITED
REPORT BASED ON LOCATION OF BRANCH
CONCLUSION

This project was completed on time and is found working effectively under all
circumstances that may arise in real environment. The program objective specifies on
the requirement is believed to be met. Using the facilities and functionalities of python
and mysql , the program has been developed in neat manner.

This program is simple and user friendly. The speed and accuracy are maintained in
proper way. Testing of the program has given good result.

The program is done with an insight into necessary modifications that is required in the
future.
BIBLIOGRAPHY
1. Text Book for class 12 Computer Applications by Sumita Arora
2. Text Book for class 11 Computer Applications by Sumita Arora
3. www.google.com
4. www.wikipedia.com
5. https://www.w3schools.com
6. https://www.tutorialspoint.com/

You might also like