- Introduction
- Project Overview
- Getting Started
- Code Structure
- Features
- Code Refactoring
- Usage
- Compile and Run
- Author
Welcome to the documentation for the Bank Application. This project demonstrates fundamental object-oriented programming concepts in Java, including encapsulation, user input validation, and interactive console-based menus for performing basic banking operations.
The Bank Application allows users to perform the following tasks:
- Deposit money into their account.
- Withdraw money from their account.
- View account balance and previous transactions.
- Calculate interest over a specified period.
- Interact through a user-friendly console-based menu.
- Java Development Kit (JDK) installed on your system.
- Basic understanding of Java and command-line operations.
- Clone or download the project files (
Account.java
andFirstBank.java
). - Follow the instructions in Compile and Run to execute the application.
The project consists of the following files:
-
Account.java
:
Contains theAccount
class with methods to handle banking operations like deposit, withdraw, check balance, and calculate interest. -
FirstBank.java
:
Contains themain
method to create account instances and display the application menu.
deposit(int amount)
: Adds the specified amount to the account balance.withdraw(int amount)
: Subtracts the specified amount from the account balance.getPreviousTransaction()
: Displays the most recent transaction.calculateInterest(int years)
: Calculates interest over a specified period.showMenu()
: Displays the main menu for user interaction.
- Entry point of the application where accounts are initialized and the menu is displayed.
- Deposit Money: Adds funds to the account and records the transaction.
- Withdraw Money: Deducts funds from the account and records the transaction.
- Check Balance: Displays the current account balance.
- Previous Transaction: Shows the last transaction performed.
- Calculate Interest: Calculates the future balance after applying a fixed interest rate over a specified number of years.
- Interactive Menu: Console-based user interface for navigation and operations.
- Used private variables and public getter/setter methods to ensure data encapsulation.
- Added checks to ensure that only valid amounts are deposited or withdrawn.
- Enhanced user experience with clear instructions and error messages for invalid inputs.
- Run the program using the following command:
java FirstBank
- Follow the Menu Options Displayed in the Console
- A: Check your account balance.
- B: Deposit money into your account.
- C: Withdraw money from your account.
- D: View your previous transaction.
- E: Calculate interest for a specified number of years.
- F: Exit the application.
- Deposit 500: Select
B
and enter500
. - Withdraw 200: Select
C
and enter200
. - Check Balance: Select
A
.
To compile the Java files, run the following command:
javac FirstBank.java
To execute the application, run:
java FirstBank
This project was developed as a hands-on Java practice to demonstrate fundamental object-oriented programming concepts and banking operations.