Advertisement
davidjack4

Untitled

Nov 14th, 2018
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PinLockout
  4. {
  5. public static void main( String[] args )
  6. {
  7. Scanner keyboard = new Scanner(System.in);
  8. int pin = 12345;
  9. int tries = 0;
  10.  
  11. System.out.println("Welcome to First Citizens Bank.");
  12. System.out.print("Please enter your PIN: ");
  13. int entry = keyboard.nextInt();
  14. tries++;
  15.  
  16. while ( entry != pin && tries < 4 )
  17. {
  18. System.out.println("Wrong. Please retry agian.");
  19. System.out.print("Please enter your PIN:");
  20. entry = keyboard.nextInt();
  21. tries++;
  22. }
  23.  
  24. if ( entry == pin )
  25. System.out.println("\nYour PIN entered is correct. Your account is now accesable.");
  26. else if ( tries >= 3 )
  27. System.out.println("\nYou have exheeded the amount of tries to enter your PIN, this acount is now locked");
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement