Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. public void welcome() {
  2.  
  3.         System.out.println("Welcome to Hotel California");
  4.         System.out.println("----------------------------");
  5.         System.out.println("Do you want to register or log in?");
  6.         System.out.println("[1] for registration");
  7.         System.out.println("[2] to login");
  8.  
  9.         String input = scan.nextLine();
  10.  
  11.         if (input == "1") {
  12.             register();
  13.         } else if (input == "2") {
  14.             logIn();
  15.         } else {
  16.             System.out.println("Did not understand input. Try again please");
  17.         }
  18.  
  19.     }
  20.  
  21.     public void register() {
  22.  
  23.         System.out.print("Please enter your name: ");
  24.         String name = scan.nextLine();
  25.         System.out.print("Please enter a desired password: ");
  26.         String pw = scan.nextLine();
  27.  
  28.         Guest g1 = new Guest(name, pw);
  29. //        glist.add(g1);
  30.         g1.setLoggedin(true);
  31.         this.loggedIn = true;
  32.  
  33.     }
  34.  
  35.     public boolean logIn() {
  36.  
  37.         System.out.print("Please enter your name: ");
  38.         String name = scan.nextLine();
  39.         System.out.print("Please enter your password: ");
  40.         String pw = scan.nextLine();
  41.  
  42. //        for (Guest singleguest : glist) {                UDKOMMENTERET FORDI GLIST IKKE ER DET KORREKTE NAVN FOR LISTEN
  43. //            if (singleguest.getName().equals(name)) {
  44. //                if (singleguest.getPassword().equals(pw)) {
  45. //                    this.cuser = singleguest;
  46. //                    this.loggedIn = true;
  47. //                }
  48. //            }
  49. //        }
  50.  
  51.         return false;
  52.     }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement