Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:30, neekWYB
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
image
Computers and Technology, 23.06.2019 09:10, babyskitt
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
image
Computers and Technology, 24.06.2019 10:00, lashaunahard
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
image
Computers and Technology, 24.06.2019 10:30, brandon1748
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
Do you know the correct answer?
Some websites impose certain rules for passwords. Suppose the password rules are as follows: 1. A p...

Questions in other subjects:

Konu
Computers and Technology, 21.09.2020 02:01
Konu
Mathematics, 21.09.2020 02:01