RAJKIYA PRATHIBA VIKAS VIDYALAYA
DELHI – 110092
SESSION 2024-25
COMPUTER PROJECT ON BANK
MANAGEMENT
NAME: CHETAN
CLASS : XII A
CLASS ROLL NO : 12109
CERTIFICATE
This is to certify that Cadet PRIYANSHU CBSE Roll No:_________________
has successfully completed the project Work entitled Fitness Centre in the
subject Computer Science (083) laid down in the regulations of CBSE for the
purpose of Practical Examination in Class XII to be held in RPVV IP
Extnension Patparganj Delhi -92
([Link] Sharma)
PGT Comp Science
Signature of External Examiner
Name: _______________________
Examiner Number:_______________
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on
the encouragement and guidelines of many others. I take this opportunity to express
my gratitude to the people who have been instrumental in the successful completion
of this project.
I express my heartfelt gratitude to my parents for constant encouragement
while carrying out this project.
I gratefully acknowledge the contribution of the individuals who contributed in
bringing this project up to this level, who continues to look after me despite my flaws,
I express my deep sense of gratitude to the luminary The Principal, RPVV IP
Extension Delhi-92 who has been continuously motivating and extending their
helping hand to us.
My sincere thanks to Mr. Akant Sharma, Master In-charge, A guide, A Mentor
, who critically reviewed my project and helped in solving each and every problem,
occurred during implementation of the project
The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the success
of the project. I am grateful for their constant support and help.
CONTENTS
1) Introduction
2) System Requirements
3) Source code
4) Output
5) Bibliography
INTRODUCTION
This Python program provides a basic framework for
managing bank accounts, including:
Account Creation: Allows staff to create new customer
accounts with essential details like name, address, and
initial deposit.
Account Transactions: Enables staff to process deposits
and withdrawals for existing accounts, while maintaining
transaction records.
Account Information: Provides options to view account
balances, customer details, and transaction histories.
Account Updates: Allows staff to update customer
information, such as address and phone number.
Account Closure: Enables staff to close customer
accounts.
User Management: Includes a simple login system for
staff and administrators, with different levels of access to
system functionalities.
Key Features:
Database Integration: Utilizes MySQL to store and
manage customer data, account information, and
transaction records.
Data Integrity: Implements basic data validation and
checks to ensure data consistency and prevent errors.
User-Friendly Interface: Provides a simple command-line
interface for easy interaction with the system.
This program serves as a foundational example for building a
more comprehensive bank management system. It can be
further expanded to include features like loan management,
interest calculations, reporting, and a more sophisticated user
interface.
Note: This is a simplified version and may not be suitable for
real-world banking applications, which require robust security
measures, compliance with regulations, and advanced
features.
I hope this introduction is helpful!
SYSTEM REQUIREMENTS
[Link] : AMD® Ryzen 7 4700g with radeon
[Link] × 16
[Link] Space : 1GB or More
[Link] System : :Ubuntu 20.04.4 LTS(64-
bit)
[Link] Version : Python 3.11.1
[Link] Version : 8.0
SOURCE CODE
import [Link]
from prettytable import PrettyTable
# Connecting to the database
mydatabase = [Link](host="localhost", user="root", password="0123")
mycursor = [Link]()
# Creating database and tables
[Link]("create database if not exists bank")
[Link]("use bank")
# Modify the TRANSACTION table to include a unique transaction_id and prevent duplicate
transactions on the same day
[Link]("""
CREATE TABLE IF NOT EXISTS COSTUMER(
name VARCHAR(40),
acc_no BIGINT PRIMARY KEY,
address VARCHAR(60),
status VARCHAR(50),
mobile_no VARCHAR(15),
deposit DECIMAL(10, 2)
)
""")
# Add a UNIQUE constraint on acc_no and TR_DATE to prevent duplicate transactions for
the same day
[Link]("""
CREATE TABLE IF NOT EXISTS TRANSACTION(
transaction_id INT AUTO_INCREMENT PRIMARY KEY,
acc_no BIGINT,
DEPOSIT DECIMAL(10, 2),
WITHDRAW DECIMAL(10, 2),
TR_DATE DATE,
FOREIGN KEY (acc_no) REFERENCES COSTUMER(acc_no),
UNIQUE(acc_no, TR_DATE) -- Ensure no duplicate transactions for the same account
on the same day
)
""")
[Link]("""
CREATE TABLE IF NOT EXISTS USER(
user_id VARCHAR(20) PRIMARY KEY,
password VARCHAR(255),
type VARCHAR(10)
)
""")
# TO CREATE ACCOUNT
def createAccount():
try:
accNo = int(input("Enter the account no (11 digits): "))
except ValueError:
print("Invalid account number. Please enter a numeric value.")
return
# Check if account number already exists
[Link]("SELECT acc_no FROM COSTUMER WHERE acc_no=%s", (accNo,))
if [Link]() is not None:
print("Account number already exists!")
return
name = input("Enter the account holder name: ")
address = input("Enter address: ")
mobile_no = input("Enter mobile number: ")
# Validate deposit amount
deposit = float(input("Enter the initial deposit amount: "))
if deposit <= 0:
print("Initial deposit must be greater than zero.")
return
sql_q = "insert into COSTUMER values(%s,%s,%s,'active',%s,%s)"
sql_p = (name, accNo, address, mobile_no, deposit)
[Link](sql_q, sql_p)
[Link]()
print("Your account has been successfully added.")
# Check if account exists
def wrong(acc_no):
[Link]("select acc_no from COSTUMER where acc_no=%s", (acc_no,))
m = [Link]()
if len(m) == 0:
print("Wrong account number.")
return False
return True
# TO DEPOSIT MONEY
def deposit():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
# Check if account is closed
[Link]("SELECT status FROM COSTUMER WHERE acc_no=%s", (acc_no,))
status = [Link]()
if status[0] == 'c':
print("Account is closed. Cannot perform transactions.")
return
amount = float(input("Enter amount to deposit: "))
if amount <= 0:
print("Amount must be greater than zero.")
return
try:
mydatabase.start_transaction()
# Check if the transaction already exists for this account
[Link]("""
SELECT * FROM TRANSACTION
WHERE acc_no=%s AND TR_DATE=CURRENT_DATE
""", (acc_no,))
if [Link]():
print("A transaction has already been processed today for this account.")
return
sql = "UPDATE COSTUMER SET deposit = deposit + %s WHERE acc_no = %s"
sql_p = (amount, acc_no)
trans = "INSERT INTO TRANSACTION (acc_no, DEPOSIT, TR_DATE) VALUES
(%s, %s, CURRENT_DATE)"
p = (acc_no, amount)
[Link](trans, p)
[Link](sql, sql_p)
[Link]()
print("Amount successfully added.")
except Exception as e:
[Link]()
print(f"Error: {e}")
# TO WITHDRAW MONEY
def withdraw():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
# Check if account is closed
[Link]("SELECT status FROM COSTUMER WHERE acc_no=%s", (acc_no,))
status = [Link]()
if status[0] == 'c':
print("Account is closed. Cannot perform transactions.")
return
amount = float(input("Enter amount to withdraw: "))
if amount <= 0:
print("Amount must be greater than zero.")
return
# Check for sufficient funds
[Link]("SELECT deposit FROM COSTUMER WHERE acc_no=%s",
(acc_no,))
balance = [Link]()[0]
if balance < amount:
print("Insufficient funds.")
return
# Check if the transaction already exists for this account
[Link]("""
SELECT * FROM TRANSACTION
WHERE acc_no=%s AND TR_DATE=CURRENT_DATE
""", (acc_no,))
if [Link]():
print("A transaction has already been processed today for this account.")
return
sql = "UPDATE COSTUMER SET deposit = deposit - %s WHERE acc_no = %s"
sql_p = (amount, acc_no)
withdraw = "INSERT INTO TRANSACTION (acc_no, WITHDRAW, TR_DATE)
VALUES (%s, %s, CURRENT_DATE)"
p = (acc_no, amount)
[Link](withdraw, p)
[Link](sql, sql_p)
[Link]()
print("Amount successfully withdrawn.")
# TO CHECK BALANCE
def balance():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
[Link]("select deposit from COSTUMER where acc_no=%s", (acc_no,))
balance = [Link]()
if balance is None:
print("Account not found.")
else:
print("Current balance:", balance[0])
# TO SHOW CUSTOMER DETAILS
def info():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
[Link]("select * from COSTUMER where acc_no=%s", (acc_no,))
customer = [Link]()
if customer:
columns = ["NAME", "ACC_NO", "ADDRESS", "STATUS", "MOBILE_NO",
"DEPOSIT"]
mytable = PrettyTable(columns)
mytable.add_row(customer)
print(mytable)
else:
print("Account not found.")
# TO SHOW ALL CUSTOMER DETAILS
def allc():
sql = "select * from COSTUMER"
[Link](sql)
customers = [Link]()
columns = ["NAME", "ACC_NO", "ADDRESS", "STATUS", "MOBILE_NO",
"DEPOSIT"]
mytable = PrettyTable(columns)
for customer in customers:
mytable.add_row(customer)
print(mytable)
# TO SHOW ALL TRANSACTIONS
def allt():
sql = "select * from TRANSACTION order by TR_DATE"
[Link](sql)
transactions = [Link]()
columns = ["ACC_NO", "DEPOSIT", "WITHDRAW", "TR_DATE"]
mytable = PrettyTable(columns)
for transaction in transactions:
mytable.add_row(transaction)
print(mytable)
# TO UPDATE CUSTOMER INFORMATION
def update():
print("Press 1 to update name")
print("Press 2 to update address")
print("Press 3 to update mobile number")
choice = int(input("Enter your choice: "))
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
if choice == 1:
name = input("Enter new name: ")
sql = "UPDATE COSTUMER SET name=%s WHERE acc_no=%s"
sql_p = (name, acc_no)
[Link](sql, sql_p)
elif choice == 2:
address = input("Enter new address: ")
sql = "UPDATE COSTUMER SET address=%s WHERE acc_no=%s"
sql_p = (address, acc_no)
[Link](sql, sql_p)
elif choice == 3:
mobile_no = input("Enter new mobile number: ")
sql = "UPDATE COSTUMER SET mobile_no=%s WHERE acc_no=%s"
sql_p = (mobile_no, acc_no)
[Link](sql, sql_p)
[Link]()
print("Information updated successfully.")
# TO CLOSE ACCOUNT
def close():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
sql = "UPDATE COSTUMER SET status='c' WHERE acc_no=%s"
sql_p = (acc_no,)
[Link](sql, sql_p)
[Link]()
print("Account has been closed.")
# TO SHOW TRANSACTIONS
def trans():
acc_no = int(input("Enter account number: "))
if not wrong(acc_no): # Use the updated wrong function
return
[Link]("SELECT * FROM TRANSACTION WHERE acc_no=%s ORDER BY
TR_DATE", (acc_no,))
transactions = [Link]()
columns = ["ACC_NO", "DEPOSIT", "WITHDRAW", "TR_DATE"]
mytable = PrettyTable(columns)
for transaction in transactions:
mytable.add_row(transaction)
print(mytable)
# USER MENU
def staff():
while True:
print("Press 1 to open a new account")
print("Press 2 to deposit money")
print("Press 3 to withdraw money")
print("Press 4 to check balance")
print("Press 5 to view customer details")
print("Press 6 to update customer information")
print("Press 7 to close account")
print("Press 8 to view transaction details")
print("Press 9 to exit")
choice = int(input("Enter your choice: "))
if choice == 1:
createAccount()
elif choice == 2:
deposit()
elif choice == 3:
withdraw()
elif choice == 4:
balance()
elif choice == 5:
info()
elif choice == 6:
update()
elif choice == 7:
close()
elif choice == 8:
trans()
else:
break
# ADMIN MENU
def admin():
while True:
print("Press 1 to open a new account")
print("Press 2 to deposit money")
print("Press 3 to withdraw money")
print("Press 4 to check balance")
print("Press 5 to view customer details")
print("Press 6 to update customer information")
print("Press 7 to close account")
print("Press 8 to view transaction details")
print("Press 9 to view all customer details")
print("Press 10 to view all transactions")
print("Press 11 to exit")
choice = int(input("Enter your choice: "))
if choice == 1:
createAccount()
elif choice == 2:
deposit()
elif choice == 3:
withdraw()
elif choice == 4:
balance()
elif choice == 5:
info()
elif choice == 6:
update()
elif choice == 7:
close()
elif choice == 8:
trans()
elif choice == 9:
allc()
elif choice == 10:
allt()
else:
break
# LOGIN SYSTEM
def login():
user_id = input("Enter user ID: ")
password = input("Enter password: ")
sql_q = "SELECT * FROM USER WHERE user_id=%s AND password=MD5(%s);"
sql_p = (user_id, password)
[Link](sql_q, sql_p)
user = [Link]()
if user is None:
print("Invalid username/password.")
return
elif user[2] == 'staff':
staff()
elif user[2] == 'admin':
admin()
# SIGNUP SYSTEM
def signup():
user_id = input("Enter user ID: ")
password = input("Enter password: ")
utype = input("Enter type (admin/staff): ")
sql_q = "INSERT INTO USER VALUES (%s, MD5(%s), %s)"
sql_p = (user_id, password, utype)
[Link](sql_q, sql_p)
[Link]()
# Main Menu
while True:
print("Press 1 to login")
print("Press 2 to sign up")
print("Press 3 to exit")
choice = int(input("Enter your choice: "))
if choice == 1:
login()
elif choice == 2:
signup()
elif choice == 3:
break
else:
print("invalid choice")
OUTPUT
BIBLIOGRAPHY
Books : COMPUTER SCIENCE WITH PYTHON
PREETI ARRORA CLASS XII
Websites : [Link]
[Link]