0% found this document useful (0 votes)
23 views

Computer Project Final - pdf2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Computer Project Final - pdf2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

ACKNOWLEDGEMENT

I wish to express my deep gratitude and sincere


thanks to the Principal Rev. Dr. Roy PK, and Vice
Principal Rev. Fr. Kelvin Olikunnel, for their
encouragement and for all the facilities they
provided for this project work. I sincerely appreciate
their magnanimity by taking me into their fold for
which I shall remain indebted to them.
I would like to thank Mrs. Tintu Merin Kurian my
computer teacher, who guided me to the successful
completion of this project.
I would like to thank my parents who helped me
throughout for the completion of the project.
I also express my sincere thanks to my classmates for
their valuable advice and support, which I received
from time to time.
Besides all, I thank God Almighty for His eternal
presence and blessings.
HUSTLERS
BANKING
SYSTEM
INDEX
SL.NO CONTENTS PAGE NO.
1 INTRODUCTION 1
2 OBJECTIVES 2
3 SYSTEM 3
SPECIFICATIONS
4 SOURCE CODE 4
5 OUTPUT 11
6 CONCLUSION 14
7 BIBLIOGRAPHY 15
INTRODUCTION
The Hustlers Banking System is a Python-driven
banking application designed to handle core banking
operations such as creating accounts, depositing and
withdrawing funds, transferring money, and checking
balances. This system leverages the CSV (Comma-
Separated Values) module for data management,
making it lightweight, easy to maintain, and highly
adaptable.
By using a CSV file for data storage, the system
ensures that all account-related information is stored
in a structured, human-readable format. This design
makes the Hustlers Banking System an excellent
choice for educational purposes, small-scale banking
simulations, and beginner-level projects that teach
how to implement persistent data storage in Python
without relying on databases.
OBJECTIVES
 Create a bank account
 Deposit money in your account
 Withdraw money from your account
 Check your account balance
 Transfer money
 Display all accounts
SYSTEM
SPECIFICATIONS
 PROCESSOR: AMD RyzenTM7 580 0H Processor
3.2GHz upto 4.4GHz(8 Cores, 16 Threads, 16M
cache)
 MEMORY: 16GB DDR4-3200, Max capacity:32 GB
 GRAPHIC CARD: NVIDIA Geforce RTXTM 3060
Laptop GPY, Upto 1630MHz at 90W, 6GB GDDR6
 STORAGE:512GB M.2NVMeTMPCle 3.0SSD
 OPERATING SYSTEM: Windows 10
 BACK-END: CSV
 FRONT-END: Python IDLE
SOURCE CODE
import csv

CSV_FILE = 'accounts.csv'

def initialize_csv():
try:
file = open(CSV_FILE, 'r')
file.close()
except FileNotFoundError:
file = open(CSV_FILE, 'w+')
writer = csv.writer(file)
writer.writerow(['Account Number', 'Account Holder',
'Balance'])
file.close()

# Function to create a new account


def create_account(account_number, account_holder,
balance=0):
if account_exists(account_number):
print(f"Error: Account number {account_number} already
exists.")
else:
file = open(CSV_FILE, 'a+')
writer = csv.writer(file)
writer.writerow([account_number, account_holder,
balance])
file.close()
print(f"Account created successfully for {account_holder}
with Account Number: {account_number}.")

# Function to check if an account exists


def account_exists(account_number):
file = open(CSV_FILE, 'r')
reader = csv.DictReader(file)
for row in reader:
if row['Account Number'] == str(account_number):
file.close()
return True
file.close()
return False

# Function to get account details


def get_account(account_number):
file = open(CSV_FILE, 'r')
reader = csv.DictReader(file)
for row in reader:
if row['Account Number'] == str(account_number):
file.close()
return row
file.close()
return None

# Function to update the balance of an account


def update_account_balance(account_number, new_balance):
rows = []
file = open(CSV_FILE, 'r+')
reader = csv.DictReader(file)
for row in reader:
if row['Account Number'] == str(account_number):
row['Balance'] = str(new_balance)
rows.append(row)
file.close()

file = open(CSV_FILE, 'w+')


writer = csv.DictWriter(file, fieldnames=['Account Number',
'Account Holder', 'Balance'])
writer.writeheader()
writer.writerows(rows)
file.close()

# Function to deposit money into an account


def deposit(account_number, amount):
if not account_exists(account_number):
print("Error: Account number not found.")
return
if amount <= 0:
print("Error: Deposit amount must be positive.")
return

account = get_account(account_number)
new_balance = float(account['Balance']) + amount
update_account_balance(account_number, new_balance)
print(f"Deposit of ${amount} successful! New balance:
${new_balance}.")

# Function to withdraw money from an account


def withdraw(account_number, amount):
if not account_exists(account_number):
print("Error: Account number not found.")
return
if amount <= 0:
print("Error: Withdrawal amount must be positive.")
return

account = get_account(account_number)
current_balance = float(account['Balance'])

if amount > current_balance:


print("Error: Insufficient balance.")
return

new_balance = current_balance - amount


update_account_balance(account_number, new_balance)
print(f"Withdrawal of ${amount} successful! Remaining
balance: ${new_balance}.")

# Function to check the balance of an account


def check_balance(account_number):
if not account_exists(account_number):
print("Error: Account number not found.")
return

account = get_account(account_number)
print(f"Account Balance for {account['Account Holder']}:
${account['Balance']}.")

# Function to transfer money between two accounts


def transfer(from_account_number, to_account_number,
amount):
if not account_exists(from_account_number):
print(f"Error: From-account {from_account_number} not
found.")
return
if not account_exists(to_account_number):
print(f"Error: To-account {to_account_number} not
found.")
return
if amount <= 0:
print("Error: Transfer amount must be positive.")
return
from_account = get_account(from_account_number)
to_account = get_account(to_account_number)

from_balance = float(from_account['Balance'])
to_balance = float(to_account['Balance'])

if amount > from_balance:


print("Error: Insufficient funds in the source account.")
return

new_from_balance = from_balance - amount


new_to_balance = to_balance + amount

update_account_balance(from_account_number,
new_from_balance)
update_account_balance(to_account_number,
new_to_balance)

print(f"Transfer of ${amount} from {from_account['Account


Holder']} to {to_account['Account Holder']} successful!")

# Function to display all accounts (for admin purposes)


def display_all_accounts():
file = open(CSV_FILE, 'r')
reader = csv.DictReader(file)
print(f"{'Account Number':<15} {'Account Holder':<20}
{'Balance':<10}")
print("-" * 45)
for row in reader:
print(f"{row['Account Number']:<15} {row['Account
Holder']:<20} ${row['Balance']:<10}")
file.close()

# Function to print the main menu


def print_main_menu():
print("\nWelcome to Hustlers Banking System!")
print("1. Create Account")
print("2. Deposit")
print("3. Withdraw")
print("4. Check Balance")
print("5. Transfer Money")
print("6. Display All Accounts")
print("7. Exit")

# Main function to handle user input and run the banking


system
def mainfn():
initialize_csv()

while True:
print_main_menu()
choice = input("Enter your choice: ")

if choice == '1':
account_number = input("Enter account number: ")
account_holder = input("Enter account holder name: ")
create_account(account_number, account_holder)

elif choice == '2':


account_number = input("Enter account number: ")
amount = float(input("Enter deposit amount: "))
deposit(account_number, amount)

elif choice == '3':


account_number = input("Enter account number: ")
amount = float(input("Enter withdrawal amount: "))
withdraw(account_number, amount)
elif choice == '4':
account_number = input("Enter account number: ")
check_balance(account_number)

elif choice == '5':


from_account_number = input("Enter from-account
number: ")
to_account_number = input(‘’Enter to-account
number:’’)
amount = float(input("Enter transfer amount: "))
transfer(from_account_number, to_account_number,
amount)

elif choice == '6':


display_all_accounts()

elif choice == '7':


print("Thank you for using Hustlers Banking System.
Come again!")
break

else:
print("Invalid choice. Please try again.")
# Entry point
if __name__ == "__main__":
mainfn()
OUTPUT
CONCLUSION
The Hustlers Banking System is a robust yet simple
banking solution that provides essential banking
functionalities while relying on the CSV module for
data storage and persistence. The use of CSV files
makes the system easy to maintain, highly
portable, and accessible to non-technical users.
The system can be further extended with
additional features, such as interest calculation,
loan management, or
account history tracking, by leveraging the simplicity
and flexibility of Python’s CSV module.
This program is ideal for small-scale banking
operations or as a learning tool for those looking to
understand how file handling and data persistence
can be implemented in Python.
BIBLIOGRAPHY
 NCERT TEXT BOOK FOR COMPUTER
 https://www.upgrad.com/blog/python-banking-
project/
 https://www.geeksforgeeks.org/working-csv-
files-python/
 https://projectworlds.in/tag/bank-management-
system-project-in-python-using-csv/

You might also like