Enter your pin


import java.util.Scanner;

public class ent
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        int pin = 12345;
        
        System.out.println("Welcome to the bank of Jacob");
        System.out.println("Please enter your pin: ");
        int entry = keyboard.nextInt();
        
        while ( entry != pin )
        {
                System.out.println("I'm sorry, the pin you have entered in incorrect. Please check our pin number and try again.");
                System.out.println("Please enter your pin: ");
                entry = keyboard.nextInt();
        }
        
        System.out.println("Correct pin. You now have access to your account");
        
    }
}
// while is similar because it responds to something where you have to input something and it compares it to something else. having no "entry" part in the loop makes the loop go on forever.
    

Picture of the output

Assignment 60 Assignment 60 Assignment 60