Simple Bank Management
System: Design & Simulation
This presentation outlines the design and simulation of a simple bank management
system. Our focus is on replicating core banking operations for account holders,
leveraging object-oriented programming principles. We will explore how classes and
objects facilitate operations such as deposits, withdrawals, balance inquiries, and
transfers, providing a clear and modular approach to financial transaction management.
Faizan Ali - BC240406400
System Overview & Objectives
Objective                                    Scope                                           Benefits
To provide a straightforward command-line    The system encompasses core                     This simulation serves as an excellent
interface for simulating essential banking   functionalities including account creation,     practical application for demonstrating
operations. This system is designed for      processing of various financial transactions,   fundamental Object-Oriented Programming
individual account holders to manage their   and convenient balance viewing. It's a          (OOP) concepts. It highlights how classes
personal funds efficiently.                  foundational model for understanding            and objects can model real-world entities
                                             banking interactions.                           and their interactions.
Core Architecture: Classes & Objects
Account Class                                                             Bank Class
Represents a single bank account within the system.                       Manages all individual Account objects in the system.
   Attributes:                                                               Attributes:
       account_number: A unique identifier for each account.                     accounts: A dictionary where keys are account_numbers and
       balance: A floating-point number representing the current funds.          values are corresponding Account objects.
       account_holder_name: A string storing the name of the account         Objects: Typically, there will be a single Bank instance, for example,
       owner.                                                                my_bank_system, which orchestrates all account operations.
   Objects: Each instance of the Account class, such as user1_savings
   or user2_checking, holds its own unique data for these attributes.
Fundamental Operations: Functions
     Deposit
     The deposit(account_number, amount) function safely increases the account.balance for the specified account. It ensures funds are
     added correctly and reflected immediately.
     Withdraw
     The withdraw(account_number, amount) function decreases the account.balance after validating that sufficient funds are available,
     preventing overdrafts.
     Check Balance
     The get_balance(account_number) function provides the current account.balance, offering quick access to financial information
     without altering the account state.
     Transfer
     The transfer(from_acc_num, to_acc_num, amount) function atomically combines a withdrawal from one account and a deposit to
     another, ensuring a secure and consistent fund movement.
     Create Account
     The create_account(name, initial_deposit) function instantiates a new Account object and integrates it into the Bank.accounts
     system, ready for transactions.
System Interaction Flow: Function Calling
                                                                                               Internal Flow
                                              Action Execution                                 The Bank.deposit() method, for instance,
User Interface                                User input directly triggers specific function   internally calls the
The system features a simple, menu-driven     calls. For example, if a user chooses            account_object.deposit(amount) method.
command-line interface, providing intuitive   'Deposit', the system will prompt for the        This nested calling structure ensures proper
prompts for users to select desired banking   account number and the amount,                   data encapsulation and maintains the
actions.                                      subsequently calling                             modularity of the system's design.
                                              my_bank_system.deposit(account_num
                                              ber, amount).
Program Structure: Account Class (Python)
   class Account:
      def __init__(self, account_number, account_holder_name, initial_balance=0.0):
         self.account_number = account_number
         self.account_holder_name = account_holder_name
         self.balance = initial_balance
      def deposit(self, amount):
         if amount > 0:
           self.balance += amount
           print(f"Deposit of ${amount:.2f} successful. New balance: ${self.balance:.2f}")
         else:
           print("Deposit amount must be positive.")
      def withdraw(self, amount):
         if 0 < amount <= self.balance:
           self.balance -= amount
           print(f"Withdrawal of ${amount:.2f} successful. New balance: ${self.balance:.2f}")            elif amount <= 0:
           print("Withdrawal amount must be positive.")
         else:
           print("Insufficient funds.")
      def get_balance(self):
         return self.balance
      def __str__(self):
         return f"Account No: {self.account_number}, Holder: {self.account_holder_name}, Balance: ${self.balance:.2f}"
   # Example Usage (will be part of the Bank class implementation)
   # acc = Account("12345", "Alice Smith", 1000)
   # acc.deposit(500)
   # acc.withdraw(200)
   # print(acc)
This Python code defines the Account class, a core component of our bank management system. It includes an initializer (__init__) to set up account
number, holder name, and initial balance. Methods for deposit and withdraw manage balance changes with validation. The get_balance method
retrieves the current balance, and __str__ provides a readable representation of the account.