الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

طلب مساعده في Passwordchecker

مغلق
بدأه azy8000 في 31 أكتوبر 2007 · 1 رد · 605 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

حاولت في كتابة البرنامج ولكن واجهتني عدة مشاكل وسوف اضع الكود في النهاية ( ماتوصلت اليه )

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


	}

تم تعديل هذه المشاركة بواسطة azy8000 في 31 أكتوبر 2007 في 18:34

#2

يمكنك الإطلاع على دوال String

أظن أن هناك دالة تسمى match

راجع الوصلة التالية أظن أنها تفيدك

http://java.sun.com/j2se/1.4.2/docs/api/ja...attern.html#sum

هذه الصفحة تحتوي على Summary of regular-expression constructs

نفسها تستطيع استخدامها مع الدالة match

الله معك

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

هذا الموضوع مغلق.

مواضيع مشابهة