Java program to create a basic and simple ATM machine

 Java program to create a basic and simple ATM machine 

In the below example, I have created a simple JAVA program for an ATM machine. If you want to withdraw cash, you need to provide your debit/credit card pin, and then the authentication happens at the backend. Since this code is solely written for those champs who are in the beginner stage of Java Programming, so major backend things are excluded in the code.

import java.io.*;
class ATM
{public static void main()throws IOException
    {BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("         Automated Teller Machine(ATM)           ");
        System.out.println("Press 1 to withdraw cash");
        int a=Integer.parseInt(br.readLine());
        if(a==1)
        {System.out.println("Please enter and drag the atm card");
        System.out.println("Enter amount:");
        double amt=Double.parseDouble(br.readLine());
        System.out.println("Enter 4 digit pin");
        double pin=Double.parseDouble(br.readLine());
        System.out.println("                        ");
        System.out.println("                        ");
        System.out.println(amt+"   Withdrawn");
        System.out.println("                        ");
        System.out.println("!!TRANSACTION SUCCESSFUL!!");
        System.out.println("                        ");
        System.out.println("Receipt delivered.");
    }
    else 
    {System.out.println("INVALID INPUT");
}
}
}









No comments:

Powered by Blogger.