-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpinLock.java
More file actions
27 lines (27 loc) · 767 Bytes
/
pinLock.java
File metadata and controls
27 lines (27 loc) · 767 Bytes
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
/**
* Created by fattyduck on 3/23/15.
*/
import java.util.Scanner;
public class pinLock {
public static void main(String[] args){
Scanner cow=new Scanner(System.in);
int pin=12345;
int tries=0;
System.out.println("Enter your pin");
int userin=cow.nextInt();
tries+=1;
while(userin!=pin){
System.out.println("INCORRECT PIN PLEASE TRY AGAIN");
System.out.println("Enter your pin");
userin=cow.nextInt();
tries++;
if(tries>=5){
System.out.println("Sorry you have been locked out");
break;
}
}
if(userin==pin){
System.out.println("Welcome to bank of cows");
}
}
}