You are on page 1of 7

**INTRODUCTION**

The Banking Management System (BMS) is a digital infrastructure that plays a vital role within
financial institutions by automating key banking functionalities. Serving as a centralized software
solution, BMS manages customer accounts, processes transactions, ensures security, and delivers
efficient customer service. Its core features include account management, transaction processing,
customer relationship management, security enforcement, and data analytics. BMS aims to enhance
operational efficiency, improve customer service, mitigate security and compliance risks, and provide
data-driven insights for informed decision-making. Leveraging technologies such as database
management systems, programming languages, security protocols, and web technologies, BMS
addresses challenges related to data security, regulatory compliance, and integration to meet the
evolving needs of the banking industry.

**Overview**

This Python program emulates a basic banking system capable of creating accounts, performing user
authentication, and executing banking activities such as checking balances, depositing funds, and
withdrawing money.

**Functionalities**

1. **create_account()**

- **Purpose:** Enables users to create a new bank account.

- **Input:**

- Username: Unique identifier for the user.

- Password: Access credential for the account.

- Initial Balance: Amount to set as the starting balance.

- **Output:**

- Success message upon account creation.

- Notification if the username already exists.

2. **login()**
- **Purpose:** Allows users to log in to an existing account.

- **Input:**

- Username: User’s unique identifier.

- Password: Account access credential.

- **Output:**

- Successful login grants access to banking functionalities.

- Notifications for failed login attempts.

3. **check_balance(username, password)**

- **Purpose:** Enables users to check their account balance after a successful login.

- **Input:**

- Username: User’s unique identifier.

- Password: Account access credential.

- **Output:**

- Displays the current account balance if credentials match.

- Invalid credentials notification otherwise.

4. **deposit(username, password, amount)**

- **Purpose:** Allows logged-in users to deposit money into their account.

- **Input:**

- Username: User’s unique identifier.

- Password: Account access credential.

- Amount: Money to deposit.

- **Output:**

- Updates the account balance upon successful deposit.

- Notifications for invalid credentials or non-positive deposit amounts.


5. **withdraw(username, password, amount)**

- **Purpose:** Enables logged-in users to withdraw funds from their accounts.

- **Input:**

- Username: User’s unique identifier.

- Password: Account access credential.

- Amount: Money to withdraw.

- **Output:**

- Updates the account balance upon successful withdrawal.

- Notifications for insufficient funds, non-positive withdrawal amounts, or invalid credentials.

6. **Main Menu**

- **Purpose:** Provides users with options to create accounts, log in, or exit.

- **Input:**

- User’s selection from the available banking options.

- **Output:**

- Executes the chosen banking operation or navigates to the appropriate action.

7. **Banking Operations Menu**

- **Purpose:** Offers banking functionalities post-login (checking balance, depositing,


withdrawing, logging out).

- **Input:**

- User’s selection from the available banking options.

- **Output:**

- Executes the chosen banking operation or navigates to the appropriate action.

**Usage**

- **Create Accounts:**
- Select the “Create Account” option and input a unique username, password, and initial balance to
create an account.

- **Login:**

- Choose the “Login” option and enter the username and password to access banking
functionalities.

- **Banking Activities (Post-Login):**

- After a successful login, select from options such as checking balance, depositing, withdrawing, or
logging out.

- **Exiting the Program:**

- Choose the “Exit” option from the main menu to terminate the program.

**Error Handling**

The program handles various scenarios, including:

- Invalid inputs for the amount (non-numeric, negative values).

- Insufficient balance for withdrawals.

- Invalid login credentials.

- Invalid or out-of-range menu selections.

**SOURCE CODE**

```python

# Dictionary to store account details

accounts = {}
def create_account():

username = input("Enter a username: ")

# Check if the username already exists

if username in accounts:

print("Username already exists. Please choose another username.")

return

password = input("Enter a password: ")

initial_balance = float(input("Enter initial balance: "))

# Creating the account

accounts[username] = {

'password': password,

'balance': initial_balance

print("Account created successfully!")

def check_balance(username, password):

if username in accounts and accounts[username]['password'] == password:

print(f"Hello, {username}! Your current balance is: ${accounts[username]['balance']}")

else:

print("Invalid username or password. Please try again.")

def deposit(username, password, amount):

if username in accounts and accounts[username]['password'] == password:

if amount <= 0:

print("Deposit amount should be greater than zero.")

else:
accounts[username]['balance'] += amount

print(f"Deposit successful. Your new balance is: ${accounts[username]['balance']}")

else:

print("Invalid username or password. Deposit failed.")

def withdraw(username, password, amount):

if username in accounts and accounts[username]['password'] == password:

if amount <= 0:

print("Withdrawal amount should be greater than zero.")

elif accounts[username]['balance'] < amount:

print("Insufficient funds. Withdrawal failed.")

else:

accounts[username]['balance'] -= amount

print(f"Withdrawal successful. Your new balance is: ${accounts[username]['balance']}")

else:

print("Invalid username or password. Withdrawal failed.")

def login():

username_input = input("Enter your username: ")

password_input = input("Enter your password: ")

if username_input in accounts and accounts[username_input]['password'] == password_input:

return True, username_input

else:

print("Invalid username or password. Login failed.")

return False, None

def main():

while True:
print("\nSelect an option:")

print("1. Create Account")

print("2. Login")

print("3. Exit")

choice = input("Enter your choice: ")

if choice == '1':

create_account()

elif choice == '2':

logged_in, username = login()

if logged_in:

while True:

print("\nSelect an option:")

print("1. Check Balance")

print("2. Deposit")

print("3. Withdraw")

print("4. Logout")

banking_choice = input("Enter your choice: ")

if banking_choice == '1':

check_balance(username, accounts[username]['password'])

elif banking_choice == '2':

try:

deposit_amount = float(input("Enter deposit amount: $"))

deposit(username, accounts[username]['password'], deposit_amount)

You might also like