Question: Create a Java program to test a candidate password. A good password must: Consist of at least eight characters. Include at least 1 upper case

Create a Java program to test a candidate password. A good password must:

Consist of at least eight characters.

Include at least 1 upper case letter.

Include at least 2 digits

Include at least one of the following special characters.

Display a prompt to the user to enter a candidate password.

Output problems with the candidate password or if the candidate password meets all requirements output a message that the password is good.

Test the program to make sure it runs correctly. Turn in the Java source code and your program results.

Hints: a. The Scanner method next() will return the String entered.

b. You need variables for number of digits, number of upper case letters and number of special characters.

c. The String method length() will return an int value of the number of characters in the String.

d. A loop is needed to look at each character in the candidate password. Any loop will work. Use the loop counter as the index of the candidate password character to be checked.

e. The String method charAt(i) where i is the String character position will return the char at that position.

f. On each loop iteration update variables for

1. number of digits

2. number of upper case letters

3. number of special characters

g. When the loop completes, determine if the candidate password has all the requirements of a good password.

Useful Character class methods to test char variables are:

Character.isDigit() returns true if the char is a digit.

Character.isUpperCase() returns true if the char is an uppercase letter.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!