Assignment 60, Enter Your PIN
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: EnterPIN
///File Name: EnterPIN.java
///Date Finshed: 12/9/15
import java.util.Scanner;
import java.util.Random;
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 CHASE BANKING.");
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.");
//a while loop is an if statement but but you don't have to copy and paste the statement over and over again
//there's no int in front of the second entry bc we've already est. that it is an int
//it repeats forever if i don't have a second entry
}
}
Picture of the output