Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. package hotelcalifornia;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5.  
  6. /**
  7. *
  8. * @author Lovro
  9. */
  10. public class HotelCalifornia {
  11.  
  12. /**
  13. * @param args the command line arguments
  14. */
  15. public static void main(String[] args) {
  16. Boolean con = true;
  17. System.out.println("Welcome to Hotel California");
  18. registration();
  19. }
  20.  
  21. public static void registration() {
  22. Scanner s = new Scanner(System.in);
  23. Customer c = new Customer();
  24. Boolean con = true;
  25. System.out.println("If you want to check our rooms, you have to register!");
  26. String answer = s.nextLine();
  27. while (con) {
  28. System.out.println("-----REGISTRATION-----");
  29. System.out.println("Insert your name: ");
  30. c.setName(s.nextLine());
  31. System.out.println("Insert your password: ");
  32. c.setPassword(s.nextLine());
  33. System.out.println("Your name is: " + c.getName());
  34. System.out.println("Your password is: " + c.getPassword());
  35. System.out.println("-----LOGIN-----");
  36. System.out.println("Your name: ");
  37. String name = s.nextLine();
  38. System.out.println("Your password: ");
  39. String password = s.nextLine();
  40. if (name.equals(c.getName()) && password.equals(c.getPassword())) {
  41. System.out.println("You have now logged in as " + c.getName());
  42. System.out.println(c.getPassword());
  43. break;
  44. } else if (name != c.getName() || password != c.getPassword()) {
  45. System.out.println("You have entered wrong name and/or password, you have to register first!");
  46.  
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement