Java代写:CMSC131PasswordCheckerandGenerator


代写密码校验器以及生成器。

Overview

In this project, you will implement a password checker and generator in Java.
The main objective of this project is to reinforce your understanding on the
String class.
You must use Eclipse to work on this project. Download first a file
p4-starter.zip from Canvas and import into Eclipse. Then, complete the methods
in the classes: CheckPasswords and PasswordGenerator. If you need, you can
write additional methods in the classes, but you must not modify the header of
the methods already given in the class files.

Requirements

The following are the password rules used by a web site:

  • A password must be at least 8 and no more than 32 characters in length.
  • A password must contain at least one character from each of the following sets:
    • Uppercase alphabet (A-Z)
    • Lowercase alphabet (a-z)
    • Numbers (0-9) OR special characters (such as # @ $ &) - i.e., a password without any special character can be a valid password if it has at least one digit, and vice versa.
  • A password may not begin or end with the space character.
  • A password may not contain more than two consecutive identical characters.
  • A password may not be (or be a variation of ) a dictionary word in English or many other languages. This includes making simple substitutions of digits or punctuation that resemble alphabetic characters. In specific, 0 (for o), 1 (for l), and $ (for s).
  • The length of the password is at least 5 characters longer than a dictionary word.
  • Passwords should not contain: carriage return (ASCII 13, ‘\r’), linefeed (ASCII 10, ‘\f’), /, , or a trailing * symbol).
    You will complete the following methods in CheckPasswords.java:

static int countUppercaseLetters(String password)

Count the number of uppercase letters in password and returns the count; can
assume only ASCII characters. Returns the number of upper case letters. For
example, if password is ABC2928fh, it returns 3.

static int countLowercaseLetters(String password)

Count the number of lowercase letters in password and returns the count; can
assume only ASCII characters. For example, if password is ABC2928fh, it
returns 2.

static int longestConsecutiveIdenticalCharacters(String password)

Count the longest sequences of consecutive identical characters; can assume
only ASCII characters. Returns the maximum repeat count. For example, given
the password helloworld, this method returns 2. Similarly, for aabaaaahd, it
returns 4.

static boolean similarToWord(String word, String password)

Check to see if a password is to similar to a dictionary word. It is too
similar if the dictionary word (the first parameter) is contained in the
password (the second parameter) when ignoring case and treating ‘1’ and ‘l’ as
identical , ‘o’ and ‘0’ as identical, and ‘s’ and ‘$’ as identical, and the
length of the password should be at least 5 characters longer than the word.
Otherwise, they are considered similar. For example, if galaxy is the value of
word and galaxy1234 is the value of password, this method returns true, but it
returns false for galaxy12345.

static boolean checkPassword(String password, String[] dictionary)

Check to see if password, given as a parameter, conforms to the password rules
described above. It returns false if the password does not conform to any of
the rules. Otherwise it returns true.
You will also complete the following method in PasswordGenerator.java:

static String generatePassword(int wordCount, Random r, String[] words)

Generate a password from the list of words provided. The password should be
concatenation of wordCount number of words, and no word should be repeated
more than once.
There are several ways to ensure that no word is used more than once. The
simplest is, as you generate a candidate word to be appended to the password
being generated, to ensure that it isn’t already contained in what has already
been generated.
There is no need to check that the password satisfies the UMD password
restrictions, or any of the conditions checked by CheckPassword. All random
numbers should be generated using the supplied Random object r. This will
allow for deterministic testing.

Other Requirements

Follow a good coding style. You are expected to use meaningful variable names,
to format your code well (use the Source - Format menu in Eclipse for
automatic format), and to document your code properly.
You are required to write your name, directory ID, university ID, and section
number as a comment at the top of each Java file.
You are also required to put comments in your code too! Your code should be
readable with appropriate comments, and you will need to use meaningful
variable names. Good use of variables, rather than “magic numbers” (literal
constants) is mandatory. There are no explicit requirements for how many and
what type of variables. For readability including variable naming, we suggest
you to use these rules:

  • Format the code clearly with blank lines, spacing and indents
  • Use self-documenting, meaningful variable names
  • Use variable names that begin with lower case and then camel case e.g., roomTemp if two words
  • Use capital letters (e.g., ALL CAPS ) for variables that encodes constant values that aren’t updated
  • Use appropriate comments that indicate what a section, or a complicated line, does
    Additionally, we expect you to write the honor pledge (I pledge on my honor
    that I have not given or received any unauthorized assistance on this
    assignment/examination.) as a comment near the top of each Java file you
    submit.

Submission and Grading

Submit your work to P4 in the submit server by the due date/time (Check the
submit server). It is strongly recommended to submit directly using the
‘Submit Project’ menu in Eclipse. After submission, check in the submit server
that your work is submitted correctly and also that your code passed all
tests.
Your work will be evaluated by running test cases against your code. There are
three test sets - public tests, release tests, and secret tests. You must pass
all public/release/secret tests for receiving the full credits.
Every time you submit your code, the submit server will test the code against
the public tests and will show test results in a table. Once you passes all
public tests, you will see a “Perform Release Test” button in the submit
server. Note that the release test can be run only 3 times a day and also that
only 2 failed tests will be displayed in the result table.

Good Faith Attempt Policy for Projects

Your work must pass 12 out of 17 public tests.


文章作者: SafePoker
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 SafePoker !
  目录