Computer Science Project (bank management)
Computer Science Project (bank management)
Submitted by
Pramesh Khadka
Certificate
This is to certify that this work entitled Hotel Management System
was done under my guidance and submitted on:_________
• SYSTEM REQUIREMENTS
• SYNOPSIS
• SOURCE CODE
• OUTPUT
• BIBLIOGRAPHY
INTRODUCTION
About Python:
Python is a widely used general-purpose, high level programming
language. It was created by Guido Van Rossum in 1991 and further
developed by the Python software foundations. It was designed
with an emphasis on code readability, and its syntax allows
programmers to express the concept in fewer lines of code.
Hardware Requirements:
• 8.00 GB or above.
Software Requirements:
The car rental system will incorporate several key features, including
customer registration and management, car inventory tracking, rental
booking and management, payment processing, and reporting.
Customers will be able to create profiles, view available cars, make
reservations, and track their rental history. The system will also
manage car inventory, including details such as make, model, year, and
availability. Financial transactions, such as payments and refunds, will
be handled securely and efficiently. Finally, the system will generate
various reports, such as rental summaries and financial statements,
to aid in business analysis and decision-making.
LIBRARY
Mysql.connector:
# FUNCTIONS
# Creating connection
def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="12345",
database="mybank"
)
# Creating tables
def create_tables():
db = connect_to_db()
cursor = db.cursor()
try:
# Creating accounts table
cursor.execute("""
CREATE TABLE IF NOT EXISTS accounts (
account_number VARCHAR(20) PRIMARY KEY,
name VARCHAR(100),
balance DOUBLE
)
""")
# Creating transactions table
cursor.execute("""
CREATE TABLE IF NOT EXISTS transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
account_number VARCHAR(20),
transaction_type VARCHAR(10),
amount DECIMAL,
)
""")
db.commit()
except Exception as e:
print("Error creating tables:", e)
finally:
cursor.close()
db.close()
# Exit function
def exit_program():
print("Thanks for using Kar Banking System. Goodbye!")
exit()
#MAIN PROGRAM
print()
print(" $$$ <==== Welcome to Kn Banking System! ====> $$$")
print()
while True:
display_menu()
try:
choice = int(input("Enter your choice (1-6): "))
if choice == 1:
account_number = input("Enter Account Number: ")
name = input("Enter Name: ")
balance = float(input("Enter Initial Balance: "))
create_account(account_number, name, balance)
elif choice == 2:
account_number = input("Enter Account Number: ")
amount = float(input("Enter Amount to Deposit: "))
deposit(account_number, amount)
elif choice == 3:
account_number = input("Enter Account Number: ")
amount = float(input("Enter Amount to Withdraw: "))
withdraw(account_number, amount)
elif choice == 4:
account_number = input("Enter Account Number: ")
db = connect_to_db()
cursor = db.cursor()
try:
cursor.execute(
"SELECT * FROM accounts WHERE account_number = %s",
(account_number,)
)
account = cursor.fetchone()
if account:
print("\nAccount Details:")
print(f"Account Number: {account[0]}")
print(f"Name: {account[1]}")
print(f"Balance: {account[2]}")
else:
print("Account not found.")
except Exception as e:
print("Error:", e)
finally:
cursor.close()
db.close()
elif choice == 5:
account_number = input("Enter Account Number: ")
db = connect_to_db()
cursor = db.cursor()
try:
cursor.execute(
"SELECT * FROM transactions WHERE account_number = %s",
(account_number,)
)
transactions = cursor.fetchall()
if transactions:
print("\nTransaction History:")
for transaction in transactions:
print(
f"ID: {transaction[0]}, Type: {transaction[2]}, Amount: {transaction[3]}"
)
else:
print("No transactions found for this account.")
except Exception as e:
print("Error:", e)
finally:
cursor.close()
db.close()
elif choice == 6:
exit_program()
else:
print("Please choose a valid option (1-6).")
except Exception:
print("Invalid input! Please enter a valid number.")
Examples:
Improvements and Suggestions:
1. Python book:
Class 11&12 Computer Science with Python.
Author name: SumitaArora
2. GITHUB
3. Google
THANK YOU