Skip to content

A compact and efficient C++-based Bank Management System that supports essential banking operations, with data organized in JSON and CSV formats for structured storage.

License

Notifications You must be signed in to change notification settings

kreeeesh17/bank-managment-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bank Management System

Made with C++ MIT License Platform Status

A lightweight and scalable C++ console application featuring core banking functionalities with structured data storage in JSON and CSV.

πŸ“Œ Features

βœ… Create Accounts (Savings & Current)
βœ… View Account Details
βœ… Modify Account (Name & Type)
βœ… Deposit & Withdraw Money
βœ… Delete Account
βœ… Save & Load Data in JSON
βœ… Export Data to CSV

πŸ“œ Table of Contents

  1. Installation & Setup
  2. Usage Guide
  3. File & Directory Structure
  4. Code Explanation
  5. Data Storage Formats
  6. Error Handling
  7. Contribution Guidelines
  8. License
  9. Credits & Authors

βš™οΈ Installation & Setup

πŸ”Ή Prerequisites

  • C++ Compiler (GCC, Clang, MSVC, etc.)
  • C++17 or later
  • JSON Library (nlohmann/json)

πŸ”Ή Steps to Run

1️⃣ Clone the Repository:

git clone https://github.com/kreeeesh17/bank-managment-system.git
cd bank-management-system

2️⃣ Compile the Code:

g++ -o bank main.cpp src/user.cpp -std=c++17 -Iinclude

OR

make

3️⃣ Run the Program:

./bank

OR

make run

4️⃣ Clear the Database and Executables after use:

make clean

πŸ“– Usage Guide

1️⃣ Create an Account

  • The system prompts for Name and Account Type (Savings/Current).
  • Generates a unique account number based on the date and a counter.

2️⃣ View Account Details

1. Enter your account number.
2. See Number, Name, Balance, and Type.

3️⃣ Deposit Money

1. Enter account number.
2. Enter deposit amount.
3. Balance updates automatically.

4️⃣ Withdraw Money

1. Enter account number.
2. Enter withdrawal amount.
3. If sufficient balance β†’ Success.
4. If not β†’ Error message.

5️⃣ Modify Account

1. Enter account number.
2. Change Name & Account Type.
3. Data is saved instantly.

6️⃣ Delete Account

1. Enter account number.
2. Confirm deletion.
3. Account is removed from JSON file.

7️⃣ Export Accounts to CSV

1. Select CSV export option.
2. Data saved in `data/accounts.csv`.

πŸ“ File & Directory Structure

Bank Management System/
β”‚
β”œβ”€β”€ .gitignore                 # Specifies files and directories that should be ignored by Git
β”œβ”€β”€ LICENSE                    # Open-source MIT license for the project
β”œβ”€β”€ README.md                  # Project description, installation, usage, and details
β”œβ”€β”€ Makefile                   # Instructions for building and cleaning the project
β”œβ”€β”€ build/                     # Directory for future build artifacts (currently empty)
β”‚
β”œβ”€β”€ data/                       # Directory containing data files (accounts.json, accounts.csv)
β”‚   β”œβ”€β”€ accounts.json
β”‚   └── accounts.csv
β”‚
β”œβ”€β”€ include/                   # Header files
β”‚   β”œβ”€β”€ json.hpp                # JSON library (external)
β”‚   └── user.h                  # User class definition
β”‚
β”œβ”€β”€ src/                        # Source files
β”‚   └── user.cpp                # User class implementation
β”‚
β”œβ”€β”€ main.cpp                    # Main program entry point
└── bin/                        # (Optional) Directory for executables (not used directly in this setup)

πŸ› οΈ Code Explanation

πŸ”Ή User Class (user.h & user.cpp)

  • Private Members
    • account_number, user_name, account_balance, account_type
  • Public Methods
    • createAccount() β†’ Takes user input & generates account.
    • displayAccount() β†’ Prints details of the account.
    • deposit(double amount) β†’ Adds money to the account.
    • withdraw(double amount) β†’ Deducts money from the account.
    • modifyAccount() β†’ Changes name & type of the account.
    • deleteAccount() β†’ Removes account data from the storage.
    • toJson() β†’ Converts the user object to a JSON format.
    • saveToJson() β†’ Saves all accounts to data/accounts.json.
    • loadFromJson() β†’ Reads account data from JSON and updates the users list.
    • exportToCSV() β†’ Exports all account data to data/accounts.csv.

πŸ”Ή getCurrentDate() Function

  • Returns the current date in YYYYMMDD format, which is used to generate unique account numbers by combining it with a static counter.

πŸ”Ή Static Counter

  • A static counter is used to generate unique account numbers. This ensures that each account number is distinct and incremented automatically with every new account creation.

πŸ“‚ Data Storage Formats

πŸ”Ή JSON File Format (data/accounts.json)

[
    {
        "account_number": "0000202502261",
        "user_name": "John Doe",
        "account_balance": 1000.50,
        "account_type": "Savings"
    }
]

πŸ”Ή CSV File Format (data/accounts.csv)

Account Number,Name,Balance,Type
0000202502261,John Doe,1000.50,Savings

❌ Error Handling

βœ” Invalid Inputs β†’ If incorrect data is entered, prompts reappear for correction.
βœ” Insufficient Balance β†’ Withdrawals are blocked if the account has insufficient funds.
βœ” File Errors β†’ If JSON/CSV files fail to open, errors are displayed.

πŸ”§ Industry Readiness & Best Practices

  • Memory Efficiency
    βœ… Uses a global vector<User> to store all users, avoiding redundant data loading.
    βœ… A static counter for unique account number generation ensures efficient handling without conflicts.

  • Modern C++ Practices
    βœ… Structured serialization of objects using nlohmann/json.
    βœ… RAII principles: Destructor ensures proper memory management.
    βœ… No raw pointersβ€”uses smart memory management.

  • Scalability & Maintainability
    βœ… Enum-based account types: Future-proof design with extendable account types.
    βœ… Global unordered_map<Type, std::string> allows for efficient lookup of account types.
    βœ… The code avoids dependency on compiler-specific features, ensuring broader compatibility.

  • Performance Not Sacrificed
    βœ… Efficient handling of large datasets using JSON for storage.
    βœ… Optimized file I/O with stream-based handling of file operations.

πŸ‘₯ Contribution Guidelines

βœ… Fork the repository.
βœ… Make changes in a separate branch.
βœ… Submit a pull request (PR) with a proper description of your changes.

πŸ“œ License

This project is open-source under the MIT License.

πŸ† Credits & Authors

πŸ‘¨β€πŸ’» Developed By: Kreesh Modi
πŸŽ“ IIT Kharagpur | Mechanical Engineering

About

A compact and efficient C++-based Bank Management System that supports essential banking operations, with data organized in JSON and CSV formats for structured storage.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published