In: Computer Science
import java.util.*;
import java.util.Scanner;
public class Atm_Booth
{
public static void main(String args[])
{
int b=5000, wd, dep;
Scanner s= new Scanner(System.in);
while(true)
{
System.out.println(".....ATM....");
System.out.println("Choose 1 to withdraw");
System.out.println("Choose 2 to deposit");
System.out.println("Choose 3 to check balance");
System.out.println("Choose 4 to exit");
System.out.println("Choose the operation you want to perform");
int n=s.nextInt();
switch(n)
{
case 1:
System.out.print("Enter money to be withdrawn:");
wd = s.nextInt();
if(b>= wd)
{
b=b-wd;
System.out.println("Please collect money");
}
else
{
System.out.println(" Insufficient balance");
}
System.out.println(" ");
break;
case 2:
System.out.println("Enter money to deposit");
dep=s.nextInt();
b=b+dep;
System.out.println(" Money deposited:");
System.out.println(" ");
break;
case 3:
System.out.println("Balance :"+b);
System.out.println(" ");
break;
case 4:
System.exit(0);
}
}
}
}