Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int pin = 12345;
- int tries = 0;
- System.out.println("How many times do you want to put your pin in?");
- int maximumtries = keyboard.nextInt();
- System.out.println("WELCOME TO THE BANK OF MITCHELL.");
- System.out.println("ENTER YOUR PIN:");
- int entry = keyboard.nextInt();
- tries++;
- while (entry != pin && tries < maximumtries){
- System.out.println("\nINCORRECT PIN. TRY AGAIN. ");
- System.out.println("ENTER YOUR PIN:");
- entry = keyboard.nextInt();
- tries++;
- }
- if (entry == pin)
- System.out.println("\nPIN ACCEPTED.YOU NOW HAVE ACCESS TO YOUR ACCOUNT");
- else if (tries >= maximumtries )
- System.out.println("\nYOU HAVE RUN OUT OF TRIES. ACCOUNT LOCKED.");
- }
- }
Add Comment
Please, Sign In to add comment