Java eclipse ATM

时间:2017-12-17 14:55:10

标签: java eclipse

我的问题是注册和登录。注册后,我尝试登录,但它无法正常工作。有人能告诉我为什么我无法登录以及如何解决这个问题?

void register() {
    System.out.println("+-----------------------------+");
    System.out.println("|         Registration        |");
    System.out.println("+-----------------------------+");
    System.out.print("Enter first name : ");
    firstName = scan.nextLine();
    System.out.print("Enter last name  : ");
    lastName = scan.nextLine();
    System.out.print("Enter Username   : ");
    userName = scan.nextLine();
    System.out.print("Enter PIN        : ");
    pin = scan.next();
    if  (pin.length() == 4) {
        pin = "****";
    } else {
        System.err.println("Error input : PIN is 4 digit only");
    }
    System.out.println("\n");
    System.out.println("+-----------------------------+");
    System.out.println("|      Success Registered     |");
    System.out.println("+-----------------------------+");
    System.out.println("First name : " + firstName);
    System.out.println("Last name  : " + lastName);
    System.out.println("Username   : " + userName);
    System.out.println("Pin        : " + pin);
    System.out.println("UUID       : " + uuid);
}

void login(){
    System.out.println("+-----------------------------+");
    System.out.println("|            Login            |");
    System.out.println("+-----------------------------+");
    System.out.println("Enter username : ");
    userName2 = scan.next();
    System.out.println("Enter PIN      : ");
    pin2 = scan.next();
    if (userName2.equalsIgnoreCase(userName) && pin2.equalsIgnoreCase(pin)) {
        menuLogin();
    } else {
        System.err.println("Error : Username or PIN invalid");
    }
}

0 个答案:

没有答案