- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
An ATM program in Java simulates basic banking operations such as withdrawing cash, depositing money, checking balance, and viewing the last transaction. Below is an example implementation using a switch-case structure for simplicity.
import java.util.Scanner;public class ATM {public static void main(String[] args) {int balance = 50000;String lastTransaction = "No transactions made";int pin = 1234;Scanner sc = new Scanner(System.in);System.out.print("Enter your PIN: ");int enteredPin = sc.nextInt();if (enteredPin != pin) {System.out.println("Access denied. Incorrect PIN.");return;}System.out.println("Welcome to the ATM!");while (true) {System.out.println("\n1. Withdraw Cash");System.out.println("2. Deposit Cash");System.out.println("3. Check Balance");System.out.println("4. View Last Transaction");System.out.println("5. Exit");System.out.print("Enter your choice: ");int choice = sc.nextInt();switch (choice) {case 1: // Withdraw CashSystem.out.print("Enter the amount to withdraw: ");int withdraw = sc.nextInt();if (withdraw > 0 && withdraw <= balance) {balance -= withdraw;lastTransaction = "You withdrew: Rs." + withdraw;System.out.println("Withdrawal successful! Please take your cash.");} else if (withdraw > balance) {System.out.println("Insufficient funds! Please try a smaller amount.");} else {System.out.println("Invalid amount. Please try again.");}break;case 2: // Deposit CashSystem.out.print("Enter the amount to deposit: ");int deposit = sc.nextInt();if (deposit > 0) {balance += deposit;lastTransaction = "You deposited: Rs." + deposit;System.out.println("Deposit successful! Thank you.");} else {System.out.println("Invalid amount. Please try again.");}break;case 3: // Check BalanceSystem.out.println("Your current balance is: Rs." + balance);break;case 4: // View Last TransactionSystem.out.println("Last transaction: " + lastTransaction);break;case 5: // ExitSystem.out.println("Thank you for using the ATM. Have a great day!");sc.close();return;default:System.out.println("Invalid choice. Please select a valid option.");}}}}Copied!✕Copy Java Program to Display the ATM Transaction - GeeksforGeeks
Dec 19, 2025 · ATM (Automated Teller Machine) transaction system allows users to perform basic banking operations such as withdrawing money, depositing funds, and checking account balance.
See results only from geeksforgeeks.orgSign In
ATM (Automated Teller Machine) transaction system allows users to perform basic banking operations such as withdrawing money, depositing funds, and ch…
ATM Program JAVA - Online Tutorials Library
In this article, we will learn how to build a simple ATM machine program in Java. This program lets users choose from the options displayed on the screen. Before choosing the options, the user has to enter …
GitHub - TAIMOURMUSHTAQ/ATM-Simulator-Java: A simple Java ATM …
A simple console-based ATM (Automated Teller Machine) system implemented in Java. This project is designed for beginners to understand core Java OOP concepts while simulating basic ATM operations.
simple ATM Project in Java-covering full CRUD (without DB, using ...
Jul 26, 2025 · Here's a simple ATM Project in Java that includes Account Creation, View, Deposit, Withdraw, and Deletion – covering full CRUD (without DB, using console + Java basics).
Creating a Banking ATM Simulator in Java: An Object-Oriented ...
Learn how to build a banking ATM simulator in Java using object-oriented programming concepts. Perfect for beginners and advanced learners!
ATM Simulation System Using Java With Source Code
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 …
Searches related to Learning How to Code ATM Using Java