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

Python Project

Uploaded by

shuklarohan388
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)
6 views

Python Project

Uploaded by

shuklarohan388
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/ 15

Shree Shankar Narayan Education Trust's

PRAVIN ROHIDAS PATIL COLLEGE OF


ENGINEERING & TECHNOLOGY
Affiliated to the University of Mumbai
Recognized by D.T.E. Govt. of Maharashtra | Approved by A.I.C.T.E. New Delhi

SIMPLE BANKING SYSYTEM


Submitted in partial fulfillment of the requirements
Of the Mini-Project Second Year of
Bachelors of Engineering

SAWANT ATHARVA (Roll no 57)


DUBEY BHUMI MANOJKUMAR (Roll no 58)
AMAAN BASHIR SHAIKH (Roll no 59)
SAWANT ARPITA DEVENDRA (Roll no 60)

Guided By:
Prof. Manjula Athani
Department of Computer Engineering

University of Mumbai
Academic year (2024-2025)
CERTIFICATE

This is to certify that the mini-project entitled “SIMPLE BANKING SYSTEM” is a bonafide
work of
SAWANT ATHARVA (Roll no 57)
DUBEY BHUMI MANOJKUMAR (Roll no 58)
AMAAN BASHIR SHAIKH (Roll no 59)
SAWANT ARPITA DEVENDRA (Roll no 60)
Submitted to the University of Mumbai in partial fulfillment of the requirement for the Mini-
Project Second Year of the Bachelor of Engineering in
“Computer Engineering”.

_______________________
Prof. Manjula Athani
Guide

__________________ __________________
Prof.Manjula Athani Principal
HOD Devichand Rathod
ABSTRACT

1. Brief Introduction

This project presents a Simple Banking System implemented using the Python programming language. The
primary objective is to simulate basic banking operations in a console-based environment, allowing users to
perform functions such as creating accounts, viewing balances, depositing funds, and withdrawing money.
The system uses Object-Oriented Programming (OOP) principles to manage customer data and transactions
securely and efficiently.The core component of the system is the BankAccount class, which encapsulates
account details and provides methods for deposit and withdrawal while ensuring data integrity. A simple
menu-driven interface enables users to interact with the system in a user-friendly manner. While the project
avoids complex features like databases or web integration, it lays the groundwork for future expansion into
more robust banking applications.
This simple system serves as an educational tool for beginners in programming, demonstrating essential OOP
concepts, input handling, and program control flow in Python.

0. Aim of the Micro-Project

1. To develop a simple and user-friendly banking system using Python.


2. To simulate core banking functionalities like account creation, deposit, withdrawal, and balance check.
3. To apply Object-Oriented Programming (OOP) concepts such as classes, objects, and methods.
4. To demonstrate input handling and control flow in a real-world sce
PROBLEM STATEMENT
The project titled Simple Banking System is database management software for monitoring
and controlling the system in Banks. The project “Simple Banking System” is developed in
python.In the modern world, managing financial transactions efficiently is crucial for both
individuals and institutions. Banking is an essential part of everyday life, with millions of users
depending on banking systems to manage their finances. While real-world banking applications
are complex and involve large-scale systems with databases, encryption, and network security,
there is a need for a simplified model that captures the core functionalities to help beginners
understand how such systems operate.This project aims to address the lack of basic, educational
banking simulations by building a simple, console-based banking system in Python. The
problem arises from the need to provide a practical, hands-on learning.However, many
beginners in programming lack practical exposure to real-life systems like banking
applications. There is a need for a simple, console-based banking system that simulates
essential banking operations and helps users understand how such systems function.

The challenge is to design and implement a basic banking system using Python that allows
users to:

• Create and manage bank accounts


• Deposit and withdraw funds securely
• Check account balances
• Store and process account information in an organized way

This system should demonstrate the principles of Object-Oriented Programming, user input
handling, and control structures while maintaining simplicity and clarity. It should be easy to
use, maintain, and serve as a learning tool for aspiring developers.
WORKING
1. Introduction
The project “Simple Banking System” is developed in python.In the modern world, managing
financial transactions efficiently is crucial for both individuals and institutions. Banking is an
essential part of everyday life, with millions of users depending on banking systems to
manage their finances.
2. Objectives

• Create and manage bank accounts


• Deposit and withdraw funds securely
• Check account balances
• Store and process account information in an organized way

3. System Overview
3.1 Features
User Interface (Console-based Menu)
• Simple text menu to interact with the system.
• Prompts for input (e.g., account creation, deposit amount).
BankAccount Class
• Contains attributes like account number, account holder name, and balance.
• Methods for deposit, withdrawal, balance inquiry, and account summary.
Account Management System
• Handles storage and retrieval of multiple accounts using a Python dictionary or list.
• Searches for accounts using unique account numbers.
Input Validation and Error Handling
• Ensures that inputs are valid (e.g., numeric values for money).
• Prevents overdrafts and negative balances.
Transaction Processing
• Updates account balances upon successful deposit or withdrawal.
• Displays appropriate messages for success or failure.
PROGRAM
SOURCE CODE:
1. database.py:
Handles all database operations, including creating accounts, checking balances, and
processing deposits, withdrawals, and account closures using SQLite.
import sqlite3
from sqlite3 import Error
import random
import string

# Database Connection Setup


def connect():
try:
# Connect to SQLite (it will create a file if it doesn't exist)
conn = sqlite3.connect("bank.db")
print("Connection to SQLite was successful!")
return conn
except Error as e:
print(f"Error: {e}")
return None
# Initialize the database and table if not already created
def initialize_database():
conn = connect()
if conn:
cursor = conn.cursor()
try:
# Create the accounts table if it doesn't exist
cursor.execute("""
CREATE TABLE IF NOT EXISTS accounts (
acc_id TEXT PRIMARY KEY,
name TEXT,
balance REAL DEFAULT 0.0
)
""")
conn.commit()
print("Database and table initialized.")
except Error as e:
print(f"Error: {e}")
finally:
conn.close()

# Database operations
def create_account(name, balance):
conn = connect()
if conn:
cursor = conn.cursor()
try:
# Generate a random Account ID (4 to 5 characters)
acc_id = ''.join(random.choices(string.ascii_uppercase + string.digits, k=5))
print(f"Generated Account ID: {acc_id}") # Debugging log

# Insert the account into the database


cursor.execute("INSERT INTO accounts (acc_id, name, balance) VALUES (?, ?, ?)",
(acc_id, name, balance))
conn.commit()

print("Account created successfully.") # Debugging log


return acc_id # Return the generated Account ID

except Error as e:
print(f"Database error: {e}") # Detailed error message
return None
finally:
conn.close()

def check_balance(acc_id):
conn = connect()
if conn:
cursor = conn.cursor()
try:
cursor.execute("SELECT balance FROM accounts WHERE acc_id = ?", (acc_id,))
result = cursor.fetchone()
if result:
return result[0] # Return the balance
else:
return None # Account not found
except Error as e:
print(f"Error: {e}")
finally:
conn.close()
else:
return None

def deposit_money(acc_id, amount):


conn = connect()
if conn:
cursor = conn.cursor()
try:
cursor.execute("UPDATE accounts SET balance = balance + ? WHERE acc_id = ?",
(amount, acc_id))
conn.commit()
print(f"Deposited {amount} to account {acc_id}.")
except Error as e:
print(f"Error: {e}")
finally:
conn.close()

def withdraw_money(acc_id, amount):


conn = connect()
if conn:
cursor = conn.cursor()
try:
cursor.execute("UPDATE accounts SET balance = balance - ? WHERE acc_id = ?",
(amount, acc_id))
conn.commit()
print(f"Withdrew {amount} from account {acc_id}.")
except Error as e:
print(f"Error: {e}")
finally:
conn.close()

def close_account(acc_id):
conn = connect()
if conn:
cursor = conn.cursor()
try:
cursor.execute("DELETE FROM accounts WHERE acc_id = ?", (acc_id,))
conn.commit()
print(f"Account {acc_id} closed successfully!")
except Error as e:
print(f"Error: {e}")
finally:
conn.close()

2. utils.py:
Contains helper functions for validating user inputs, such as account numbers, names, and
balances, ensuring data integrity across the system.
from tkinter import messagebox

def validate_name(name):
if not name:
messagebox.showwarning("Input Error", "Name cannot be empty!")
return False
return True
def validate_balance(balance):
try:
balance = float(balance)
if balance < 0:
messagebox.showwarning("Input Error", "Balance cannot be negative!")
return False
return True
except ValueError:
messagebox.showwarning("Input Error", "Please enter a valid balance!")
return False
def validate_account_number(acc_no):
if not acc_no.isalnum() or len(acc_no) < 4:
messagebox.showwarning("Input Error", "Account number must be a valid 4-5
character alphanumeric ID!")
return False
return True

3. app.py:
Implements the graphical user interface (GUI) using Tkinter, allowing users to interact with
the banking system for various operations like creating accounts and managing funds.
import tkinter as tk
from tkinter import messagebox, simpledialog
from database import initialize_database, create_account, check_balance, deposit_money,
withdraw_money, close_account
from utils import validate_name, validate_balance, validate_account_number

class BankingSystem(tk.Tk):
def __init__(self):
super().__init__()
self.title("Banking System")
self.geometry("600x500")
self.configure(bg="#f7f7f7") # Light gray background for the window
self.initialize_gui()
initialize_database() # Initialize the database when the app starts

def initialize_gui(self):
# Create account section (with soft royal blue background)
create_account_frame = tk.Frame(self, bg="#3498db", bd=5)
create_account_frame.pack(fill="x", padx=20, pady=10)

tk.Label(create_account_frame, text="Create Account", font=("Helvetica", 18, "bold"),


fg="white", bg="#3498db").pack(pady=10)

self.name_var = tk.StringVar()
self.balance_var = tk.StringVar()

tk.Label(create_account_frame, text="Name", font=("Helvetica", 12), fg="white",


bg="#3498db").pack()
tk.Entry(create_account_frame, textvariable=self.name_var, font=("Helvetica",
12)).pack(pady=5)

tk.Label(create_account_frame, text="Initial Balance", font=("Helvetica", 12),


fg="white", bg="#3498db").pack()
tk.Entry(create_account_frame, textvariable=self.balance_var, font=("Helvetica",
12)).pack(pady=5)

tk.Button(create_account_frame, text="Create Account", font=("Helvetica", 12),


bg="#2ecc71", fg="white", command=self.create_account).pack(pady=10)
# Account operations section (with off-white background for clarity)
operations_frame = tk.Frame(self, bg="#ffffff", bd=5)
operations_frame.pack(fill="x", padx=20, pady=10)

tk.Label(operations_frame, text="Account Operations", font=("Helvetica", 18, "bold"),


fg="#2c3e50", bg="#ffffff").pack(pady=10)
self.acc_number_var = tk.StringVar()
tk.Label(operations_frame, text="Account ID", font=("Helvetica", 12), fg="#2c3e50",
bg="#ffffff").pack()
tk.Entry(operations_frame, textvariable=self.acc_number_var, font=("Helvetica",
12)).pack(pady=5)
tk.Button(operations_frame, text="Check Balance", font=("Helvetica", 12),
bg="#9b59b6", fg="white", command=self.check_balance).pack(pady=5)
tk.Button(operations_frame, text="Deposit", font=("Helvetica", 12), bg="#1abc9c",
fg="white", command=self.deposit_money).pack(pady=5)
tk.Button(operations_frame, text="Withdraw", font=("Helvetica", 12), bg="#e74c3c",
fg="white", command=self.withdraw_money).pack(pady=5)
tk.Button(operations_frame, text="Close Account", font=("Helvetica", 12),
bg="#f39c12", fg="white", command=self.close_account).pack(pady=5)

def create_account(self):
name = self.name_var.get()
balance = self.balance_var.get()

if validate_name(name) and validate_balance(balance):


acc_id = create_account(name, balance)
if acc_id:
messagebox.showinfo("Success", f"Account Created Successfully! Your Account ID:
{acc_id}")
else:
messagebox.showwarning("Failed", "Failed to create account. Please try again.")

def check_balance(self):
acc_id = self.acc_number_var.get()
if validate_account_number(acc_id):
balance = check_balance(acc_id)
if balance is not None:
messagebox.showinfo("Balance", f"Current Balance: {balance}")
else:
messagebox.showwarning("Not Found", "Account not found!")

def deposit_money(self):
acc_id = self.acc_number_var.get()

if validate_account_number(acc_id):
amount = simpledialog.askfloat("Deposit", "Enter amount to deposit:")
if amount and amount > 0:
deposit_money(acc_id, amount)
messagebox.showinfo("Success", "Money Deposited Successfully!")
else:
messagebox.showwarning("Input Error", "Please enter a valid amount!")

def withdraw_money(self):
acc_id = self.acc_number_var.get()

if validate_account_number(acc_id):
amount = simpledialog.askfloat("Withdraw", "Enter amount to withdraw:")
if amount and amount > 0:
withdraw_money(acc_id, amount)
messagebox.showinfo("Success", "Money Withdrawn Successfully!")
else:
messagebox.showwarning("Input Error", "Please enter a valid amount!")

def close_account(self):
acc_id = self.acc_number_var.get()

if validate_account_number(acc_id):
result = messagebox.askyesno("Confirmation", "Are you sure you want to close this
account?")
if result:
close_account(acc_id)
messagebox.showinfo("Success", "Account Closed Successfully!")
else:
messagebox.showinfo("Cancelled", "Account Closure Cancelled!")

if __name__ == "__main__":
app = BankingSystem()
app.mainloop()
OUTPUT:
IF YOU WANT TO DEPOSIT A CERTAIN AMOUNT
IF WANT TO WITHDRAW A CERAIN AMOUNT
AFTER EVERY TRANSACTION WHETHER IT BE DEPOSIT OR WITHDRAW IT WOULD UPADTE THE DATA
AND WHEN YOU CHECK THE BALANCE IN IT WOULD SHOW THE CURRENT BALANCE.

AND IF WANT TO CLOSE THE ACCOUNT YOU COULD CLOSE IT.

CONCLUSION:
The Simple Banking System in Python successfully demonstrates the implementation of
basic banking functionalities using core programming concepts. By leveraging Object-
Oriented Programming (OOP) principles, the system efficiently handles account
management, transactions, and user interactions through a straightforward console interface.

You might also like