subject

Some websites impose certain rules for passwords. Suppose the password rules are as follows: 1. A password must have at least eight characters.
2. A password must consist of only letters and digits.
3. A password must contain at least two digits.
Write a program that prompts the user to enter a password and displays valid password if the rules are followed or invalid password otherwise. Create three methods (headers given below) to check the three rules.
public static boolean AtLeast8(String p)
public static boolean LetterOrDigit(String p)
public static boolean AtLeast2Digits(String p)
For example, method AtLeast8 will return true if there are at least eight characters in the password otherwise it will return false. The password is passed to the string variable p in this method. Inside the method do the following. Here are four sample runs:
Sample 1
1) Enter your password: My password18
Invalid password
Sample 2
Enter your password: pass18
Invalid password
Sample 3
Enter your password: password
Invalid password
Sample 4
Enter your password: password18
Valid password
Create a method AtLeast8 outside the main method with the header provided in the problem description.
i) If the length of p is less than 8 then return false, otherwise return true.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:10
Write an application that allows a user to enter the names and birthdates of up to 10 friends. continue to prompt the user for names and birthdates until the user enters the sentinel value “zzz” for a name or has entered 10 names, whichever comes first. when the user is finished entering names, produce a count of how many names were entered, and then display the names. in a loop, continuously ask the user to type one of the names and display the corresponding birthdate or an error message if the name has not been previously entered. the loop continues until the user enters “zzz” for a name. save the application as birthdayreminder.java.
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
What allows you to create a wireless connection among your smart devices
Answers: 2
question
Computers and Technology, 23.06.2019 01:10
Problem 1 - hashing we would like to use initials to locate an individual. for instance, mel should locate the person mark e. lehr. note: this is all upper case. generate a hash function for the above using the numbers on your telephone. you know, each letter has a number associated with it, so examine your telephone keypad. generate 512 random 3 letter initials and take statistics on a linked list array size 512 to hold this information report how many have no elements, 1 element, 2 elements, does this agree with the hashing statistics distribution?
Answers: 1
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
You know the right answer?
Some websites impose certain rules for passwords. Suppose the password rules are as follows: 1. A p...
Questions
question
Mathematics, 11.11.2020 21:40
question
Physics, 11.11.2020 21:40
question
Biology, 11.11.2020 21:40
question
Social Studies, 11.11.2020 21:40
question
Mathematics, 11.11.2020 21:40
question
Mathematics, 11.11.2020 21:40
question
Mathematics, 11.11.2020 21:40
Questions on the website: 13722363