EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

 

 

/*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.”);

}

}

 

 

}

}

Simple Banking Application using java

Leave a Reply

Your email address will not be published. Required fields are marked *

EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Popular Courses

[Course Image]

Introduction to Programming

Learn the fundamentals of programming with Python in this beginner-friendly course.

12 Hours Beginner
[Course Image]

Data Science Essentials

Master the basics of data analysis, visualization, and machine learning.

20 Hours Intermediate
[Course Image]

Web Development Bootcamp

Build modern websites with HTML, CSS, JavaScript and popular frameworks.

30 Hours Beginner
[Course Image]

Digital Marketing Fundamentals

Learn SEO, social media marketing, email campaigns and analytics.

15 Hours Beginner
Educational Website Footer