Project Code
Project Code
cur = conn.cursor()
cur.execute('''
CREATE TABLE IF NOT EXISTS customer_details (
account_no INT PRIMARY KEY,
account_name VARCHAR(25),
phone_no INT,
address VARCHAR(50),
gender VARCHAR(10),
age INT,
credit_amount FLOAT
)
''')
2)login.py
This is for employee login
import mysql.connector as sql
if choice == 1:
username = input("Enter a Username: ").strip()
password = input("Enter a Password: ").strip()
try:
cur.execute("INSERT INTO user_table (username,
password) VALUES (%s, %s)", (username, password))
conn.commit()
print("User Registered Successfully!")
except sql.errors.IntegrityError:
print("Username already exists. Please try
another one.")
elif choice == 2:
username = input("Enter Your Username: ").strip()
password = input("Enter Your Password: ").strip()
if user is None:
print("Invalid Username or Password")
else:
print("Login Successful!")
import menu1
else:
print("Invalid Choice. Exiting...")
3)menu1.py
This is the main program which contains all functions of the Bank
Management System. It contains functions such as Adding, Deleting,
Editing and Transaction.
while True:
print("\n--- BANK MENU ---")
print("1. Create Bank Account")
print("2. Transaction")
print("3. Customer Details")
print("4. Transaction Details")
print("5. Edit Account Details")
print("6. Delete Account")
print("7. Quit")
if choice == 1:
account_no = int(input("Enter your Account
Number: "))
account_name = input("Enter your Account Name:
")
phone_no = int(input("Enter your Phone Number:
"))
address = input("Enter your Address: ")
gender = input("Enter your Gender: ")
age = int(input("Enter your Age: "))
credit_amount = float(input("Enter your Credit
Amount: "))
elif choice == 2:
account_no = int(input("Enter Your Account
Number: "))
cur.execute(f"SELECT * FROM customer_details
WHERE account_no = {account_no}")
account_data = cur.fetchone()
if account_data is None:
print("Invalid Account Number. Try Again.")
else:
print("1. Withdraw Amount")
print("2. Add Amount")
transaction_choice = int(input("Enter your
choice: "))
if transaction_choice == 1:
amount1 = float(input("Enter Withdrawal
Amount: "))
cur.execute(f"UPDATE customer_details
SET credit_amount = credit_amount - {amount1} WHERE
account_no = {account_no}")
print("Amount Withdrawn Successfully!")
elif transaction_choice == 2:
amount2 = float(input("Enter Amount to
Add: "))
cur.execute(f"UPDATE customer_details
SET credit_amount = credit_amount + {amount2} WHERE
account_no = {account_no}")
print("Amount Added Successfully!")
elif choice == 3:
account_no = int(input("Enter Your Account
Number: "))
cur.execute(f"SELECT * FROM customer_details
WHERE account_no = {account_no}")
account_data = cur.fetchone()
if account_data is None:
print("Invalid Account Number")
else:
print(f"\nAccount Number:
{account_data[0]}\nAccount Name: {account_data[1]}\
nPhone Number: {account_data[2]}\nAddress:
{account_data[3]}\nGender: {account_data[4]}\nAge:
{account_data[5]}\nCredit Amount: {account_data[6]}")
elif choice == 4:
try:
account_no = int(input("Enter Your
Account Number: "))
cur.execute(f"SELECT * FROM
customer_details WHERE account_no = {account_no}")
account_data = cur.fetchone()
if account_data is None:
print("Invalid Account Number")
else:
print("Amount added :",amount2)
print("Amount Withdrawn :",amount1
except:
print()
elif choice == 5:
account_no = int(input("Enter Your Account
Number to Edit: "))
cur.execute(f"SELECT * FROM customer_details
WHERE account_no = {account_no}")
account_data = cur.fetchone()
if account_data is None:
print("Invalid Account Number")
else:
print("1. Edit Account Name")
print("2. Edit Phone Number")
print("3. Edit Address")
print("4. Edit Gender")
print("5. Edit Age")
edit_choice = int(input("Enter your choice:
"))
if edit_choice == 1:
new_name = input("Enter New Account
Name: ")
cur.execute(f"UPDATE customer_details
SET account_name = '{new_name}' WHERE account_no =
{account_no}")
elif edit_choice == 2:
new_phone = int(input("Enter New Phone
Number: "))
cur.execute(f"UPDATE customer_details
SET phone_no = {new_phone} WHERE account_no =
{account_no}")
elif edit_choice == 3:
new_address = input("Enter New Address:
")
cur.execute(f"UPDATE customer_details
SET address = '{new_address}' WHERE account_no =
{account_no}")
elif edit_choice == 4:
new_gender = input("Enter New Gender:
")
cur.execute(f"UPDATE customer_details
SET gender = '{new_gender}' WHERE account_no =
{account_no}")
elif edit_choice == 5:
new_age = int(input("Enter New Age: "))
cur.execute(f"UPDATE customer_details
SET age = {new_age} WHERE account_no = {account_no}")
elif choice == 6:
account_no = int(input("Enter Your Account
Number to Delete: "))
cur.execute(f"DELETE FROM customer_details
WHERE account_no = {account_no}")
print("Account Deleted Successfully!")
elif choice == 7:
print("Thank you for using the banking system.
Goodbye!")
break
else:
print("Invalid Choice. Try Again.")
Output
--- USER AUTHENTICATION ---
1. Register
2. Login
Enter your choice: 2
Enter Your Username: Abhi123
Enter Your Password: 12345
Login Successful!
Creating Accounts:
I would like to express my heartfelt gratitude to all those who contributed to the
successful completion of my project, "Bank Management System."
First and foremost, I am deeply thankful to my Computer Science teacher, Ms
Venkatalakshmi , for their invaluable guidance, encouragement, and support
throughout the project. Their expertise and insights have been instrumental in
shaping this work.
I am also grateful to my school, Ryan International School for providing me with
the necessary resources and infrastructure to complete this project effectively.
A special thanks to my parents and friends for their unwavering support and
encouragement during this endeavor.
This project has not only enhanced my technical skills in Python and SQL but has
also given me a deeper understanding of real-world banking operations and the
importance of database management.
Finally, I extend my gratitude to everyone who directly or indirectly supported me
in completing this project.