Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class TaskPerf6 {
- public static void main(String[] args) throws IOException {
- Scanner luh = new Scanner(System.in);
- FileWriter file = new FileWriter("C:\\Users\\Complab502-PC43\\Desktop\\register.txt");
- System.out.println("REGISTER");
- System.out.print("Enter the number of accounts: ");
- int count = luh.nextInt();
- luh.nextLine();
- for(int i = 0; i < count; i++){
- System.out.print("Enter the username: ");
- String usernameko = luh.nextLine();
- System.out.print("Enter the password: ");
- String passwordko = luh.nextLine();
- file.write(usernameko + System.lineSeparator());
- file.write(passwordko);
- }
- System.out.println("Process Saved!");
- file.close();
- System.out.println("+-------------------------+");
- System.out.println("LOGIN");
- System.out.print("Enter the username: ");
- String userko = luh.nextLine();
- System.out.print("Enter the password: ");
- String passko = luh.nextLine();
- if (userko.equals(usernameko) && passko.equals(passwordko)) {
- System.out.print("Process Login");
- }
- else {
- System.out.print("Wrong input!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement