Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PinLockout
- {
- public static void main( String[] args )
- {
- Scanner keyboard = new Scanner(System.in);
- int pin = 12345;
- int tries = 0;
- System.out.println("Welcome to First Citizens Bank.");
- System.out.print("Please enter your PIN: ");
- int entry = keyboard.nextInt();
- tries++;
- while ( entry != pin && tries < 4 )
- {
- System.out.println("Wrong. Please retry agian.");
- System.out.print("Please enter your PIN:");
- entry = keyboard.nextInt();
- tries++;
- }
- if ( entry == pin )
- System.out.println("\nYour PIN entered is correct. Your account is now accesable.");
- else if ( tries >= 3 )
- System.out.println("\nYou have exheeded the amount of tries to enter your PIN, this acount is now locked");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement