Simulate the three password verification of the ATM cash machine. If the password is entered incorrectly three times on the day, it will prompt "Account is frozen". In other cases, it will prompt how many times there are input opportunities.

tags: java

import java.util.Scanner;
 public class Atm{
  public static void main(String[] args){
  Scanner input=new Scanner(System.in);
   for (int i=2; i>=0; i–){
System.out.println("Please enter the password");
    int mima=input.nextInt();
     if(mima123456){
System.out.println("Cash it freely");
      break;
     }else if(i!=0){
System.out.println("You still have"+i+"second chance");
System.out.println ("Enter y to continue, press any key to exit");
      String shuru=input.next();
       if(!shuru.equals(“y”)){
System.out.println ("Thank you for using the ** banking system, welcome to come again");
        break;
       }
     }else if(i
0){
System.out.println ("Your account number is gone, please bring your ID to the counter");
      
     } 
   
   }
   
  }
 }


Intelligent Recommendation

C language: write code to simulate scenarios password is entered three times, up to three times enter the correct password, the prompt "login success", the password is wrong, you can re-enter, enter up to three times. Three are wrong, you are prompted to exit the program.

3. Write code simulates three scenarios password, enter up to three times the correct password, the prompt "login success", the password is wrong, can be re-entered, up to three inputs. Thre...

More Recommendation

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top