BANKING SYSTEM
Project Title: Banking System
Introduction:
The Banking System project is a console application implemented in Java, showcasing the fundamental principles of Object-Oriented Programming (OOP) through the creation of a simplified banking management system.
Overview:
This Java project aims to simulate a simplified banking system adhering to the guidelines set by the Reserve Bank of India (RBI). The system includes classes representing customers, various types of accounts, and different banks, including the State Bank of India (SBI) and ICICI Bank. It leverages object-oriented programming principles and demonstrates core concepts such as inheritance, encapsulation, and polymorphism.
Key Features:
Customer Class:
Represents a bank customer with attributes like name and date of birth.
Provides methods to retrieve customer details.
Account Class:
Models a bank account with a unique account number and balance.
Supports deposit and withdrawal operations.
Implements interest calculation for both simple and compound interest.
RBI Class:
Serves as the base class representing the Reserve Bank of India.
Defines common functionalities shared among different banks.
Includes methods to get interest rates and withdrawal limits.
SBI Class (extends RBI):
Extends the RBI class to provide functionality specific to the State Bank of India.
Overrides methods to customize interest rates.
ICICI Class (extends RBI):
Extends the RBI class to represent ICICI Bank.
Inherits common functionalities from RBI.
BankingSystem Class:
Contains the main method for initiating and running the banking simulation.
Prompts the user to select a bank, account type, and user account.
Demonstrates the calculation of interest based on user input.
Demonstrated Skills:
Object-Oriented Programming (OOP):
Effective use of classes and objects to model real-world entities.
Utilization of inheritance to represent an "is-a" relationship between classes.
Java Fundamentals:
Proper utilization of data types, loops, and conditional statements.
Exception handling for scenarios like insufficient funds during withdrawals.
User Input Handling:
Scanner class implementation for user interaction.
Encapsulation and Abstraction:
Proper encapsulation of class attributes with private access modifiers.
Abstraction through method declarations and implementation hiding.
Usage Instructions:
Run the BankingSystem class.
Follow the prompts to select a bank, account type, and user account.
Optionally, calculate interest based on the selected options.
Note:
The project showcases fundamental Java concepts and can be extended with additional features such as more sophisticated interest calculations or database integration.
NOTE : -
I HAVE KEPT A SEPERATE FILE FOR EVALUATION IN CASE IF THE ZIP FOLDER DOESN'T WORK PROPERLY PLEASE EVALUATE THIS CODE EACH CLASS HAVE ITS OWN FILE NAME YOU CAN PROCEED ACCORDINGLY.
NOTE:-
WHEN I BOOK FOR MENTORING SESSION FOR MY DOUBTS CLEARANCE NON OF THE SLOTS ARE AVAILABLE , WHEN I BOOK FOR LIVE OFFICE HOURS FOR THE SCHEDULED TIME WHEN I OPENS THE BROWSER I DIDN'T SEE THE LIVE SESSION , AND ALSO I DIDN'T RECEIVES THE MAIL TO JOIN .
package banking;
class Customer {
private String name;
private String dateOfBirth;
public Customer(String name, String dateOfBirth) {
this.name = name;
this.dateOfBirth = dateOfBirth;
}
public String getName() {
return name;
}
public String getDateOfBirth() {
return dateOfBirth;
}
}
package banking;
class Account {
private double balance;
private int accountNumber;
public Account(int accountNumber, double initialBalance) {
this.accountNumber = accountNumber;
this.balance = initialBalance;
}
public int getAccountNumber() {
return accountNumber;
}
public double getBalance() {
return balance;
}
public void deposit(double amount) {
balance += amount;
}
public void withdraw(double amount) {
if (amount <= balance) {
balance -= amount;
} else {
System.out.println("Insufficient funds!");
}
}
public double calculateSimpleInterest(double principal, double rate, int time) {
// Simple Interest formula: A = P(1 + rt)
double simpleInterest = principal * (1 + rate * time);
return simpleInterest - principal; // Total Interest = A - P
}
public double calculateCompoundInterest(double principal, double rate, int time, int n) {
// Compound Interest formula: A = P(1 + r/n)^(nt)
double compoundInterest = principal * Math.pow((1 + rate / n), (n * time));
return compoundInterest - principal; // Total Interest = A - P
}
}
package banking;
class RBI {
public double getInterestRate() {
// Common interest rate logic (can be overridden in subclasses)
return 0.05; // 5% annually
}
public double getWithdrawalLimit() {
// Common withdrawal limit logic (can be overridden in subclasses)
return 5000; // Default withdrawal limit
}
}
package banking;
class RBI {
public double getInterestRate() {
// Common interest rate logic (can be overridden in subclasses)
return 0.05; // 5% annually
}
public double getWithdrawalLimit() {
// Common withdrawal limit logic (can be overridden in subclasses)
return 5000; // Default withdrawal limit
}
}
package banking;
class RBI {
public double getInterestRate() {
// Common interest rate logic (can be overridden in subclasses)
return 0.05; // 5% annually
}
public double getWithdrawalLimit() {
// Common withdrawal limit logic (can be overridden in subclasses)
return 5000; // Default withdrawal limit
}
}
package banking;
import java.util.Scanner;
public class Banking{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to the Banking System!");
// Create a customer and account (replace with actual user input)
@SuppressWarnings("unused")
Customer customer = new Customer("John Doe", "01-01-1990");
Account account = new Account(123456, 5000); // Initial balance for demonstration
// For simplicity, let's assume the user selects SBI bank and Savings account
RBI bank = new SBI();
System.out.println("Select account type: 1. Savings 2. Current");
int accountType = scanner.nextInt();
if (accountType == 1) {
// Savings Account
System.out.println("Enter the number of years for interest calculation:");
int years = scanner.nextInt();
double principal = account.getBalance();
double interestRate = bank.getInterestRate();
double simpleInterest = calculateSimpleInterest(principal, interestRate, years);
double compoundInterest = calculateCompoundInterest(principal, interestRate, years, 1);
System.out.println("Simple Interest: " + simpleInterest);
System.out.println("Compound Interest: " + compoundInterest);
} else {
// Current Account
// Add logic for Current Account specific operations if needed
double withdrawalLimit = bank.getWithdrawalLimit();
System.out.println("Withdrawal Limit: " + withdrawalLimit);
}
// Close the scanner
scanner.close();
}
public static double calculateSimpleInterest(double principal, double rate, int time) {
// Simple Interest formula: A = P(1 + rt)
double simpleInterest = principal * (1 + rate * time);
return simpleInterest - principal; // Total Interest = A - P
}
public static double calculateCompoundInterest(double principal, double rate, int time, int n) {
// Compound Interest formula: A = P(1 + r/n)^(nt)
double compoundInterest = principal * Math.pow((1 + rate / n), (n * time));
return compoundInterest - principal; // Total Interest = A - P
}
}