Advertisement
Guest User

Untitled

a guest
Feb 11th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class TaskPerf6 {
  5. public static void main(String[] args) throws IOException {
  6. Scanner luh = new Scanner(System.in);
  7. FileWriter file = new FileWriter("C:\\Users\\Complab502-PC43\\Desktop\\register.txt");
  8.  
  9. System.out.println("REGISTER");
  10. System.out.print("Enter the number of accounts: ");
  11. int count = luh.nextInt();
  12. luh.nextLine();
  13.  
  14. for(int i = 0; i < count; i++){
  15. System.out.print("Enter the username: ");
  16. String usernameko = luh.nextLine();
  17. System.out.print("Enter the password: ");
  18. String passwordko = luh.nextLine();
  19. file.write(usernameko + System.lineSeparator());
  20. file.write(passwordko);
  21. }
  22. System.out.println("Process Saved!");
  23. file.close();
  24.  
  25. System.out.println("+-------------------------+");
  26.  
  27. System.out.println("LOGIN");
  28.  
  29. System.out.print("Enter the username: ");
  30. String userko = luh.nextLine();
  31. System.out.print("Enter the password: ");
  32. String passko = luh.nextLine();
  33.  
  34.  
  35. if (userko.equals(usernameko) && passko.equals(passwordko)) {
  36. System.out.print("Process Login");
  37. }
  38. else {
  39. System.out.print("Wrong input!");
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement