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, 22.06.2019 01:00
Duplicating objects creates copies that a. move differently than the original object b. erase the original object c. look and act like the original object d. add events to a game
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
George heard about the benefits of a data warehouse. he wants to try implementing one for his organization. however, he is afraid that transferring data to the data warehouse will affect transaction time. which element ensures that transactions are not affected when moving data to a warehouse? when data is transferred to a data warehouse, the a area frees the source system to continue transaction processing.
Answers: 2
You know the right answer?
Some websites impose certain rules for passwords. Suppose the password rules are as follows: 1. A p...
Questions
Questions on the website: 13722363