المساعدة - البحث - قائمة الأعضاء - التقويم
نسخة كاملة: طلب مساعده في Passwordchecker
برمجة - شبكات - كمبيوتر - منتديات الفريق العربي للبرمجة > منتديات لغات البرمجة العام > منتدى مبرمجي لغة جافا JAVA
azy8000
السلام عليكم ورحمة الله وبركاته
حاولت في كتابة البرنامج ولكن واجهتني عدة مشاكل وسوف اضع الكود في النهاية ( ماتوصلت اليه )

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.
.

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

كود
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))
    
  
    }
علاء الصالحي
يمكنك الإطلاع على دوال String
أظن أن هناك دالة تسمى match
راجع الوصلة التالية أظن أنها تفيدك
http://java.sun.com/j2se/1.4.2/docs/api/ja...attern.html#sum
هذه الصفحة تحتوي على Summary of regular-expression constructs
نفسها تستطيع استخدامها مع الدالة match

الله معك
هذه "نسخة - خفيفة" من محتويات الرئيسية للإستعراض الكامل مع المزيد من الصور والخيارات الرجاء إضغط هنا.
Invision Power Board © 2001-2009 Invision Power Services, Inc.