Doing experiments and new projects while learning a programming language is really fun and exciting. We are going to make a simple ATM machine project using java programming. ATM stands for Automated Teller Machine. It's possible to make a complete functional ATM project and GUI in java. But we are going to make a simple one in this article.
![]() |
ATM Machine Project in Java Programming with Code |
In our simple ATM project, the user can deposit money, withdraw, check account balance, and exit from the ATM program.
Key Features of the ATM Machine project:
- The java Program can Display the ATM Transaction
- The user can deposit money from this ATM Machine project
- The user can withdraw cash from this ATM Machine project
- The user can check the bank account balance
ATM users can deposit money to the bank by choosing the deposit option. The java program will simply get the deposit amount from the user and add the money to the user's account.
Users can withdraw money from their bank account through the program by selecting the withdrawal option. After a successful transaction, the ATM machine will deduct the amount from the central bank account.
The user can also check their existing bank account total balance using the checking account balance option.
Finally, the exit option will simply exit the users from the ATM machine program and return the user to the default main menu.
ATM Machine Java program:
//import required classes and packages | |
import java.util.Scanner; | |
//create ATMExample class to implement the ATM functionality | |
public class ATM_Machine | |
{ | |
//main method starts | |
public static void main(String args[] ) | |
{ | |
//declare and initialize balance, withdraw, and deposit | |
int balance = 0, withdraw, deposit; | |
//create scanner class object to get choice of user | |
Scanner sc = new Scanner(System.in); | |
while(true) | |
{ | |
System.out.println("ATM Machine\n"); | |
System.out.println("Choose 1 for Withdraw"); | |
System.out.println("Choose 2 for Deposit"); | |
System.out.println("Choose 3 for Check Balance"); | |
System.out.println("Choose 4 for EXIT\n"); | |
System.out.print("Choose the operation:"); | |
//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); | |
} | |
} | |
} | |
} |
ATM Machine Java Program Output:
ATM Machine project using C program with source code
Hostel Management System Project in C Programming
Post a Comment