import java.util.Scanner; public class atm{ public static void main(String[]arg){ Scanner scan = new Scanner(System.in); int userId = 100; int password = 1; int user; int pass; System.out.println("Login: "); System.out.println("Enter user Id: "); user = scan.nextInt(); System.out.println("Enter password: "); pass = scan.nextInt(); int ch=0; if(pass == password && user == userId ){ int deposite = 80000; int temp=0; int temp2=0; System.out.println("Atm menu: \n"+"1. check balence: \n"+"2. deposite: \n"+"3. withdrow: \n"+"4. transection histry: \n"+"5. exit: "); System.out.println("choose an option: "); ch = scan.nextInt(); while(ch!=5){ if(ch==1){ System.out.println(deposite); } else if(ch==2){ System.out.println("Enter deposite amont: "); temp = scan.nextInt(); deposite = temp+deposite; System.out.println(deposite); } else if(ch==3){ System.out.println("Enter Withdrow amont: "); temp2 = scan.nextInt(); deposite = deposite-temp2; System.out.println(deposite); } else if(ch==4){ System.out.println("Transaction histry: "); System.out.println("Deposite : "+temp); System.out.println("Withdrow: "+temp2); } else{ System.out.println("Invalid"); } System.out.println("Atm menu: \n"+"1. check balence: \n"+"2. deposite: \n"+"3. withdrow: \n"+"4. transection histry: \n"+"5. exit: "); System.out.println("choose an option: "); ch = scan.nextInt(); } } } } /* do{ switch(ch){ case 1: System.out.println(deposite); case 2: break; case 3: break; case 4: break; default: break; } }while(ch==5); */