用dr.java编程作业不会写 求大神帮帮忙 还有2小时作业就要due了!!!!谢谢大家!!!!
Writeaprogramthatgeneratesallpossible5letterpasswordscontainingonlylowercaseletters,u...
Write a program that generates all possible 5 letter passwords containing only lowercase
letters, uppercase letters, and/or digits. For example, “rot13” would be such a password, but
“32-Ax” would not because it has a hyphen. There are 62 letters to use (26 + 26 + 10). There
are 625 = 916132832 possible passwords.
Test each password you generate to determine if it satisfies the following rules:
COMP 1010 Fall 2014 Assignment 3 Page 2 of 6
At least one lowercase letter;
At least one uppercase letter;
At least one digit;
No character can appear twice in a row (e.g. “Haax5” is not valid, but “Ha5ax” is).
Count the number of valid passwords that satisfy the rules.
Suppose you have forgotten your password for a password-protected website. Your userid
at that website is your student ID. You decide to generate all valid passwords (according to
the above rules) and try them out as your password, together with your student ID as the
userid. That might work (but perhaps not – you might have chosen a password that doesn’t
follow these rules). Download the class file “BreakThisPassword.class” from the course
website and place it in the same folder as your code. Try each password you generate by
calling BreakThisPassword.login(studNum, password), where studNum is your
student number. This method returns a message as a String value. If the returning String is
not null, print out the password and the message.
The only program input required is a student number, obtained through JOptionPane.
Assume the user will enter a valid student number, without checking. The input prompt and
response should be echoed to the console output.
Hint: Get your code working with 3 character passwords and a smaller range of letters (‘a’
to ‘d’, ‘A’ to ‘D’, ‘0’ to ‘4’). Then try to scale it up to full letter ranges, and then to full size. It
will make debugging problems much simpler. BreakThisPassword.login is designed to
handle passwords of any length.
Hint: When you deal with five characters, running the program can take a long time
(minutes). It is a good idea to print a progress indicator, as shown in the sample output,
displaying the least rapidly changing letter of the password as it changes, so that the user
can estimate how long running the program will take. 展开
letters, uppercase letters, and/or digits. For example, “rot13” would be such a password, but
“32-Ax” would not because it has a hyphen. There are 62 letters to use (26 + 26 + 10). There
are 625 = 916132832 possible passwords.
Test each password you generate to determine if it satisfies the following rules:
COMP 1010 Fall 2014 Assignment 3 Page 2 of 6
At least one lowercase letter;
At least one uppercase letter;
At least one digit;
No character can appear twice in a row (e.g. “Haax5” is not valid, but “Ha5ax” is).
Count the number of valid passwords that satisfy the rules.
Suppose you have forgotten your password for a password-protected website. Your userid
at that website is your student ID. You decide to generate all valid passwords (according to
the above rules) and try them out as your password, together with your student ID as the
userid. That might work (but perhaps not – you might have chosen a password that doesn’t
follow these rules). Download the class file “BreakThisPassword.class” from the course
website and place it in the same folder as your code. Try each password you generate by
calling BreakThisPassword.login(studNum, password), where studNum is your
student number. This method returns a message as a String value. If the returning String is
not null, print out the password and the message.
The only program input required is a student number, obtained through JOptionPane.
Assume the user will enter a valid student number, without checking. The input prompt and
response should be echoed to the console output.
Hint: Get your code working with 3 character passwords and a smaller range of letters (‘a’
to ‘d’, ‘A’ to ‘D’, ‘0’ to ‘4’). Then try to scale it up to full letter ranges, and then to full size. It
will make debugging problems much simpler. BreakThisPassword.login is designed to
handle passwords of any length.
Hint: When you deal with five characters, running the program can take a long time
(minutes). It is a good idea to print a progress indicator, as shown in the sample output,
displaying the least rapidly changing letter of the password as it changes, so that the user
can estimate how long running the program will take. 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询