subject

Using the program Eclipse IDE for Java Developers, Version: Neon.2 Release (4.6.2)Problem Description: Some websites impose certain rules for passwords. Suppose password rules are as follows: 1. A password must have at least eight characters. 2. A password consists of only letters and digits. 3. A password must contain at least two digits. Write a program with class name CheckPassword 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. Here are four sample runs:Sample 1: Enter your password: My password18 Invalid passwordSample 2: Enter your password: pass18 Invalid password Sample3: Enter your password: password Invalid password Sample4: Enter your password: password18 Valid passwordYou can use the following steps in your code: System. out. print("Enter your password: ");1. Store the user entry in String variable named password using nextLine() method.2. Create three boolean variables isAtLeast8, isLetterDigit, and isAtLeast2Digits and assign the output of the corresponding methods to these boolean variables. For example, boolean isAtLeast8 = AtLeast8(password);3. If each boolean variable is true then display Valid password otherwise display Invalid password. //Method AtLeast84. Create a method AtLeast8 outside the main method with the header provided in the problem description. The password is passed to the string variable p in this method. Inside the method do the following. i) If the length of p is less than 8 then return false, otherwise return true. //Method LetterOrDigit5. Create a method LetterOrDigit outside the main method with the header provided in the problem description. The password is passed to the string variable p in this method. Inside the method do the followings. i) Create a loop that checks whether each character in p is a letter or a digit. To check this use the in-built methods Character. isLetterOrDigit(p. charAt(index)). The method isLetterOrDigit returns true if p. charAt(index) is a letter or digit. See Chapter 4 Table 4.6ii) If a character is not found to be a letter or digit then return false inside the loop, otherwise return true outside the loop. //Method AtLeast2Digits6. Create a method AtLeast2Digits outside the main method with the header provided in the problem description. The password is passed to the string variable p in this method. Inside the method do the followings. i) Create an integer variable count and assign zero to it. ii) Create a loop that counts the number of digits in p. The in-built method Character. isDigit(p. charAt(index)) returns true if p. charAt(index) is a digit. Increase count by one when a digit is found. iii) If the count is at least 2 then return true inside the loop, otherwise return false outside the loop.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 07:40
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Read these lines from beowulf.often scyld scefing seized mead-benches from enemytroops, from many a clan, he terrified warriors, even thoughfirst he was found a waif, best explains why the author includes this information in theexposition? a. to emphasize that a hero must learn to be fierceb. to remember the famous story of a popular heroc. to express sadness about losing the old heroesd. to see whether people still respect the old heroes
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
You know the right answer?
Using the program Eclipse IDE for Java Developers, Version: Neon.2 Release (4.6.2)Problem Descriptio...
Questions
question
History, 04.11.2020 20:40
question
Mathematics, 04.11.2020 20:40
question
Mathematics, 04.11.2020 20:40
question
Computers and Technology, 04.11.2020 20:40
question
Health, 04.11.2020 20:40
question
Mathematics, 04.11.2020 20:40
Questions on the website: 13722367