Skip to content

mummanadeviprasad456-dev/Task5-Bank-Account-Simulation

Repository files navigation

Bank Account Simulation

Author: Mummana Devi Prasad
Role: Java Developer Intern


📝 Project Description

The Bank Account Simulation is a console-based Java application designed to replicate core banking operations using Object-Oriented Programming (OOP) principles. It allows users to dynamically create standard or savings bank accounts, perform deposit and withdrawal actions with robust input checks, view real-time balances, and track their entire account ledger via an interactive transaction history.

This project was built to showcase clean coding standards, complete encapsulation, and robust edge-case validation suitable for an internship project submission.


✨ Features

  • Account Creation: Interactively set up standard bank accounts or specialized savings accounts.
  • Deposit Operations: Add money safely, ensuring only positive numbers are accepted.
  • Withdrawal Operations: Withdraw money with strict validation checks. Checks for "Insufficient Balance" and enforces minimum balance requirements for savings accounts.
  • Interest Application: Dynamically calculate and credit compound interest to savings accounts.
  • Transaction History: Real-time ledger tracking using an ArrayList to record deposits, withdrawals, interest credits, and failed transaction attempts.
  • Robust Exception Handling: Menu-driven interface protected from program crashes caused by invalid input formats (e.g., inputting text/letters instead of numbers).

🛠️ Technologies Used

  • Language: Java SE 8+
  • APIs & Frameworks: Java Standard Library (java.util.Scanner, java.util.ArrayList)
  • Tools: VS Code, Terminal (Command Prompt / PowerShell)

🏗️ OOP Concepts Demonstrated

1. Encapsulation

  • Keep data secure by making account instance variables (accountNumber, accountHolderName, balance, transactionHistory) private.
  • Provide access and modifications strictly through controlled public methods (deposit(), withdraw(), getBalance(), setAccountHolderName()).

2. Inheritance

  • The SavingsAccount class inherits standard attributes and features from the base Account class using the extends keyword.

3. Polymorphism & Method Overriding

  • Method Overriding: The SavingsAccount class overrides withdraw(double amount) to enforce a minimum balance rule of Rs. 500 and overrides displayBalance() to present interest rates.
  • Polymorphism: In BankAccountSimulation, the application keeps a reference to the base class type Account activeAccount but executes overridden methods dynamically at runtime (dynamic method dispatch) depending on whether the object instantiated is an Account or SavingsAccount.

4. Overloading

  • Constructor Overloading: The Account class defines multiple constructors—one initializing the account with a custom deposit balance, and another initializing with a default 0.0 balance.

💻 Sample Terminal Output

Below is an example session of how the console program functions:

=================================================
      WELCOME TO BANK ACCOUNT SIMULATION         
=================================================

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 1

--- Create Account ---
Select Account Type:
1. Standard Account
2. Savings Account (Enforces Rs. 500 Min Balance + Interest)
Enter choice (1-2): 2
Enter Account Number: SAV-100234
Enter Account Holder Name: Mummana Devi Prasad
Enter Initial Deposit: Rs. 1000
Enter annual interest rate (e.g. 3.5 for 3.5%, or press Enter to use default 3.5%): 4.0

Savings Account successfully created!

--- Account Balance ---
Account Number: SAV-100234
Account Holder: Mummana Devi Prasad
Current Balance: Rs. 1000.0
Account Type: Savings Account
Interest Rate: 4.0% per annum
Minimum Balance Required: Rs. 500.0
-----------------------

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 2
Enter deposit amount: Rs. 500
Successfully deposited Rs. 500.0

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 3
Enter withdrawal amount: Rs. 1100
Error: Insufficient Balance. A minimum balance of Rs. 500.0 must be maintained.
Current Balance: Rs. 1500.0 | Maximum allowed withdrawal: Rs. 1000.0

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 3
Enter withdrawal amount: Rs. 800
Successfully withdrew Rs. 800.0 from Savings Account.

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 6
Successfully applied interest of Rs. 28.0

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 5

--- Transaction History for Account SAV-100234 ---
1. Account created with initial balance: Rs. 1000.0
2. Deposited: Rs. 500.0 | Current Balance: Rs. 1500.0
3. Failed Withdrawal: Rs. 1100.0 (Enforced Minimum Balance constraint)
4. Withdrew (Savings): Rs. 800.0 | Current Balance: Rs. 700.0
5. Interest Applied (4.0%): Rs. 28.0 | Current Balance: Rs. 728.0
-------------------------------------------------------

---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 7

Thank you for using Bank Account Simulation! Goodbye.

🚀 How to Run the Program

  1. Open your terminal in the directory where the source files are located.
  2. Compile the classes using javac:
    javac Account.java BankAccountSimulation.java
  3. Run the simulation using java:
    java BankAccountSimulation

About

Java OOP project for simulating bank account operations with transaction history.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages