Assignment #60 and Enter Your PIN
Code
///Name: Trent Lane
///Period: 6
///Program Name: Enter Your PIN
///Date Finished: 12/3/15
///1. The result is only right or wrong.
///2. It goes on forever or until the right answer is achieved.
///3. Because it is not necessary
///4. It keeps displaying incorrect pin forever because there is no way to enter a new pin.
import java.util.Scanner;
public class EnterPIN
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int pin = 12345;
System.out.println("WELCOME TO THE BANK OF TRENT.");
System.out.print("ENTER YOUR PIN: ");
int entry = keyboard.nextInt();
while ( entry != pin )
{
System.out.println("\nINCORRECT PIN. TRY AGAIN.");
System.out.print("ENTER YOUR PIN: ");
entry = keyboard.nextInt()
}
System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
}
}
Picture of the output