/*Project:
Simple Banking Application:
Simple Banking Application is a simple Java project
Abstract: In this modernized world, where time is money, everyone has got the habit of doing their tasks online. Within a click, a task is done. You get this application to make transactions just by sitting in your comfort zone. Every operation like money transfer and balance inquiry can be done in seconds using this Simple Banking Application console project*/
import java.io.*;
import java.util.Scanner;
class SimpleBankingApplication {
private double balance;
public SimpleBankingApplication() {
this.balance = 0.0; // Initial balance
}
public void deposit(double amount) {//50000
if (amount > 0) {//50000>0
balance += amount;//balance=50000
System.out.println(“Deposited: $” + amount);
} else {
System.out.println(“Invalid deposit amount.”);
}
}
public void withdraw(double amount) {//25000
if (amount > 0 && amount <= balance) {
balance -= amount;//25000
System.out.println(“Withdrawn: $” + amount);
} else if (amount > balance) {
System.out.println(“Insufficient funds.”);
} else {
System.out.println(“Invalid withdrawal amount.”);
}
}
public void checkBalance() {
System.out.println(“Current balance: $” + balance);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
SimpleBankingApplication bankApp = new SimpleBankingApplication();
boolean running = true;
while (running) {
System.out.println(“\nSimple Banking Application”);
System.out.println(“1. Deposit”);
System.out.println(“2. Withdraw”);
System.out.println(“3. Check Balance”);
System.out.println(“4. Exit”);
System.out.print(“Choose an option: “);
int choice = scanner.nextInt();
switch (choice) {
case 1:
System.out.print(“Enter amount to deposit: $”);
double depositAmount = scanner.nextDouble();
bankApp.deposit(depositAmount);//50000
break;
case 2:
System.out.print(“Enter amount to withdraw: $”);
double withdrawAmount = scanner.nextDouble();
bankApp.withdraw(withdrawAmount);//25000
break;
case 3:
bankApp.checkBalance();
break;
case 4:
System.out.println(“Exiting the application.”);
running = false;
break;
default:
System.out.println(“Invalid choice. Please try again.”);
}
}
}
}