ATM Simulation System Using Java With Source Code

Introduction:
Thanks for visiting the ATM Stimulation System! This Command-Line User Interface (CLI)-based ATM Stimulation System offers a clear and easy way to execute withdrawals, deposits, and check balances. Java is the programming language used to create it. The system includes a simple command line interface with a switch case for executing deposits, withdrawals, and balance checks. It also updates the current balance after each operation. Anyone who needs to quickly calculate deposits and withdrawals should use this system. So, sit back, make a cup of coffee, and start calculating the amount in the ATM Stimulation System.
Explanation:
This Command-Line User Interface (CLI)-based ATM Stimulation System offers a clear and easy way to execute withdrawals, deposits, and check balances. The system includes a simple command line interface with a switch case for executing deposits, withdrawals, and balance checks. It also updates the current balance after each operation.
Source Code:
Get Discount on Top Educational Courses
import java.util.Scanner;
public class ATM {
public static void main(String args[]) {
// declare and initialize balance, withdraw, and deposit
int balance = 5000, withdraw, deposit;
// create scanner class object to get choice of user
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("**Automated Teller Machine**");
System.out.println("1. Withdraw");
System.out.println("2. Deposit");
System.out.println("3. Check Balance");
System.out.println("4. EXIT");
System.out.print("Choose the operation you want to perform:");
// get choice from user
int choice = sc.nextInt();
switch (choice) {
case 1:
System.out.print("Enter money to be withdrawn:");
// get the withdrawl money from user
withdraw = sc.nextInt();
// check whether the balance is greater than or equal to the withdrawal amount
if (balance >= withdraw) {
// remove the withdrawl amount from the total balance
balance = balance - withdraw;
System.out.println("Please collect your money");
} else {
// show custom error message
System.out.println("Insufficient Balance");
}
System.out.println("");
break;
case 2:
System.out.print("Enter money to be deposited:");
// get deposite amount from te user
deposit = sc.nextInt();
// add the deposit amount to the total balanace
balance = balance + deposit;
System.out.println("Your Money has been successfully depsited");
System.out.println("");
break;
case 3:
// displaying the total balance of the user
System.out.println("Balance : " + balance);
System.out.println("");
break;
case 4:
// exit from the menu
System.exit(0);
default:
//default statement
System.out.println("Invalid Choice");
}
}
}
}
This system is built using Switch Case, while loop, and Scanner class. The system will first display the user’s available options. Withdraw, Deposit, Check Balance, and EXIT are available as choices. The user must choose a useful choice. The operation will be carried out as per the input choice, and the balance will be updated following each operation. The user could also get balance information in the “Check Balance” option.
Output:

Find More Projects
Drawing Chhatrapati Shivaji Maharaj Using Python Chhatrapati Shivaji Maharaj, the legendary Maratha warrior and founder of the Maratha Empire, is an inspiration …
Resume Builder Application using Java With Source Code Graphical User Interface [GUI] Introduction: The Resume Builder Application is a powerful and user-friendly …
Encryption Tool using java with complete source Code GUI Introduction: The Encryption Tool is a Java-based GUI application designed to help users …
Movie Ticket Booking System using Java With Source Code Graphical User Interface [GUI] Introduction: The Movie Ticket Booking System is a Java …
Video Call Website Using HTML, CSS, and JavaScript (Source Code) Introduction Hello friends, welcome to today’s new blog post. Today we have …
promise day using html CSS and JavaScript Introduction Hello all my developers friends my name is Gautam and everyone is welcome to …