Assignemnt #64 and PinLock.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: PinLock
/// File Name: PinLock.java
/// Date Finished: 1/14/201
import java.util.Scanner;
public class PinLock
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int pin = 12345;
int tries = 0;
int maxtry = 4;
System.out.println("Welcome");
System.out.print("Please Enter PIN: ");
int entry = keyboard.nextInt();
tries++;
while ( entry != pin && tries < maxtry )
{
System.out.println("\nInvalid PIN Try Again");
System.out.print("Please Enter PIN: ");
entry = keyboard.nextInt();
tries++;
}
if ( entry == pin )
System.out.println("\nPIN Accepted");
else if ( tries >= maxtry )
System.out.println("\nInvalid PIN Account Locked");
}
}
Picture of the output