-
Notifications
You must be signed in to change notification settings - Fork 0
/
PinLockout.java
29 lines (25 loc) · 964 Bytes
/
PinLockout.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
int maxnum = 4;
System.out.println("\nWELCOME TO THE BANK OF MICHELL.");
System.out.print("ENTER YOUR PIN: ");
int entry = keyboard.nextInt();
tries++;
while( entry != pin && tries < maxnum)
{
System.out.println("\nINCORRECT PIN. TRY AGAIN.");
System.out.print("ENTER YOUR PIN: ");
entry = keyboard.nextInt();
tries++;
}
if( entry == pin)
System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
else if( tries >= maxnum )
System.out.println("\nMAXIMUM NUMBER OF TRIES REAACHED. ACCOUNT LOCKED, PLEASE CONTACT YOUR BANK FOR FURTHER DETAILS.");
}
}