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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Angelanova69134
Technician a says that a shop towel should never be used to clean around the flange area before replacing an automatic transmission filter. technician b says that a dimpled transmission fluid pan can be repaired. who is right
Answers: 3
image
Computers and Technology, 23.06.2019 01:30, giannav57
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
image
Computers and Technology, 23.06.2019 02:30, woodpeckerdeejpe8wvh
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
image
Computers and Technology, 23.06.2019 10:50, whyidkmyself
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
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 in other subjects:

Konu
English, 04.07.2020 22:01
Konu
English, 04.07.2020 22:01