حاولت في كتابة البرنامج ولكن واجهتني عدة مشاكل وسوف اضع الكود في النهاية ( ماتوصلت اليه )
You may assume that a password file has the following format:
* A userid or password shown in the password file is a sequence of non-whitespace characters.
* Every account has a unique userid and at least one password (so each account can have multiple passwords and the user can log in the server as long as s/he enters one of the passwords). All passwords of a single account are distinct.
* Each line of the password file contains the userid and passwords of a single account. The line begins with the userid, followed by a space, followed by the first password, followed by a space, followed by the second password, followed by a space, and so on, through to the last password. Passwords of the same account are on the same line.
* There are no blank lines in the password file.
.* A userid or password shown in the password file is a sequence of non-whitespace characters.
* Every account has a unique userid and at least one password (so each account can have multiple passwords and the user can log in the server as long as s/he enters one of the passwords). All passwords of a single account are distinct.
* Each line of the password file contains the userid and passwords of a single account. The line begins with the userid, followed by a space, followed by the first password, followed by a space, followed by the second password, followed by a space, and so on, through to the last password. Passwords of the same account are on the same line.
* There are no blank lines in the password file.
ALSO
* it contains at least seven characters,
* it contains at least one uppercase letter and one lowercase letter, and
* it contains no more than three digits
* it contains at least seven characters,
* it contains at least one uppercase letter and one lowercase letter, and
* it contains no more than three digits
كود
import java.util.*;
import java.io.*;
import javax.swing.*;
public class PasswordChecker
{
public static void main(String[] args)throws IOException
{
String file;
String line;
String user;
String password;
//int length;
Boolean validInput;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the password file's path name: ");
file = keyboard.next();
Scanner input = new Scanner(new File(file)); // input source
System.out.println("Enter the output file's path name: ");
file = keyboard.next();
PrintWriter outfile = new PrintWriter(file);
Scanner tokenizer;
file = input.nextLine();
tokenizer = new Scanner(file);
while (input.hasNext()) {
user = tokenizer.next();
for ( i=0 > password.length(-1))
}
import java.io.*;
import javax.swing.*;
public class PasswordChecker
{
public static void main(String[] args)throws IOException
{
String file;
String line;
String user;
String password;
//int length;
Boolean validInput;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the password file's path name: ");
file = keyboard.next();
Scanner input = new Scanner(new File(file)); // input source
System.out.println("Enter the output file's path name: ");
file = keyboard.next();
PrintWriter outfile = new PrintWriter(file);
Scanner tokenizer;
file = input.nextLine();
tokenizer = new Scanner(file);
while (input.hasNext()) {
user = tokenizer.next();
for ( i=0 > password.length(-1))
}