Coders Packet

ATM Transaction System Using Java

By MASNA VISHNUDEV

In this module, we are going to build a code for the ATM system using java. In this, we can perform different transactions like withdrawal, deposit, and check balance.

Implementations of the ATM transactions 

In this initially, the account is created with the balance of 10000.

The basic operations performed in the ATM are:

1.Withdraw

2.Deposit

3.Check Balance

 

To build this project different loops and switch..case is used.

 

The following code gives the complete description.

import java.util.Scanner;
class ATM
{
    public static void main(String args[] )
    {
        int balance = 10000, withdraw, deposit;
        Scanner s = new Scanner(System.in);
        System.out.println("Automated Teller Machine");
        while(true)
        {
            System.out.println("\nChoose your operation");
            System.out.println("1.Withdraw");
            System.out.println("2.Deposit");
            System.out.println("3.Check Balance");
            System.out.println("4.EXIT");

            int n = s.nextInt();
            switch(n)
            {
                case 1:
                    System.out.print("Enter money to be withdrawn:");
                    withdraw = s.nextInt();
                    if(balance >= withdraw)
                    {
                        balance = balance - withdraw;
                        System.out.println("Please collect your money");
                        System.out.println("Available balance is " +balance);
                    }
                    else
                    {
                        System.out.println("Insufficient Balance");
                    }
                    break;

                case 2:
                    System.out.print("Enter money to be deposited:");
                    deposit = s.nextInt();
                    balance = balance + deposit;
                    System.out.println("Your Money has been successfully depsited");
                    System.out.println("Available balance is "+balance);
                    break;

                case 3:
                    System.out.println("Balance : "+balance);
                    break;

                case 4:
                    System.out.println("Transaction Successful");
                    System.exit(0);
            }
        }
    }
}

Output 1:

The withdraw option allows you to withdraw money from the account.

Output 2:

The Deposit option allows you to add the money to the account.

 

Output 3:

The Check balance option allows you to know the available balance in the account.

 

 

And this is all about the ATM transaction system using java.

Thank You.

Download project

Reviews Report

Submitted by MASNA VISHNUDEV (vishnudevmasna)

Download packets of source code on Coders Packet