Guest User

Untitled

a guest
Jun 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public static void register() {
  2. userName = sc.nextLine();
  3. user.setName(userName);
  4. try {
  5. FileWriter f = new FileWriter("D:\name.txt", true);
  6. f.write(user.getName());
  7. System.out.println("Name was created!");
  8. names.put(i, user.getName());
  9. i +=1;
  10. f.flush();
  11. f.close();
  12. } catch (IOException e) {
  13. System.out.println(e.getMessage());
  14. }
  15. }
  16. public static void register1() {
  17. userPassword = sc.nextLine();
  18. user.setPassword(userPassword);
  19. try {
  20. FileWriter f = new FileWriter("D:\password.txt", true);
  21. f.write(user.getPassword());
  22. System.out.println("Password was created!");
  23. passwords.put(b, user.getPassword());
  24. b += 1;
  25. f.flush();
  26. f.close();
  27. } catch (IOException e) {
  28. System.out.println(e.getMessage());
  29. }
  30. }
  31. public static void logIn() {
  32. System.out.println("Input name: ");
  33. userName = sc.nextLine();
  34. System.out.println("Input password: ");
  35. userPassword = sc.nextLine();
  36. if(names.containsValue(userName) && passwords.containsValue(userPassword)){
  37. System.out.println("Welcome");
  38. }else{
  39. System.out.println("Fail!");
  40. }
  41. }
Add Comment
Please, Sign In to add comment