Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void register() {
- userName = sc.nextLine();
- user.setName(userName);
- try {
- FileWriter f = new FileWriter("D:\name.txt", true);
- f.write(user.getName());
- System.out.println("Name was created!");
- names.put(i, user.getName());
- i +=1;
- f.flush();
- f.close();
- } catch (IOException e) {
- System.out.println(e.getMessage());
- }
- }
- public static void register1() {
- userPassword = sc.nextLine();
- user.setPassword(userPassword);
- try {
- FileWriter f = new FileWriter("D:\password.txt", true);
- f.write(user.getPassword());
- System.out.println("Password was created!");
- passwords.put(b, user.getPassword());
- b += 1;
- f.flush();
- f.close();
- } catch (IOException e) {
- System.out.println(e.getMessage());
- }
- }
- public static void logIn() {
- System.out.println("Input name: ");
- userName = sc.nextLine();
- System.out.println("Input password: ");
- userPassword = sc.nextLine();
- if(names.containsValue(userName) && passwords.containsValue(userPassword)){
- System.out.println("Welcome");
- }else{
- System.out.println("Fail!");
- }
- }
Add Comment
Please, Sign In to add comment