Coders Packet

Simple ATM machine using Java

By Kajjayam Priya

This program is about knowing the user's data in their ATM accounts. The program is developed in Java language.

Implemenatation of simple ATM machine

The program is about collecting data of the user in ATM. In the atm program the user has to select a required option displayed on the screen. The options are withdraw the money, deposit the money, check the balance and exit are the 4 options where user can choose to check what is existing in their accounts. After performing the options we can use exit method and return to the home page.

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
int balance=100000,withdraw,deposit;
Scanner sc=new Scanner(System.in);
while(true)
{
System.out.println("Automated Teller Machine");
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");
System.out.println("Choose the operation you want to perform:");
int choice=sc.nextInt();
switch(choice)
{
case 1:
System.out.print("Enter money to be withdrawn");
withdraw=sc.nextInt();
if(balance>=withdraw)
{
balance=balance-withdraw;
System.out.print("Please collect your money");
}
else
{
System.out.println("Insufficient Balance");
}
System.out.println("");
break;
case 2:
System.out.print("Enter monet to be deposited:");
deposit=sc.nextInt();
break;
case 3:
System.out.print("Balance: " +balance);
System.out.println("");
break;
case 4:
System.exit(0);
}
}
}

OUTPUT:

Download project

Reviews Report

Submitted by Kajjayam Priya (Priya1414)

Download packets of source code on Coders Packet