Question: Use Java; Having a secure password is a very important practice when much of our information is stored online. Write a program that validates a

Use Java;
Having a secure password is a very important practice when much of our information is stored online. Write a program that validates a new password, following these rules:
The password must be at least 12 characters long.
The password must have at least one uppercase and one lowercase letter
The password must have at least one digit.
The password must have at least one special character from the set (!,@,#,$,%,^,&,*,?,:)
Write a program that asks for a password. If the passwords dont match or the rules are not fulfilled, return false. Your program should include a method that checks whether a password is valid.
For full credit, you will need to implement the following methods:
public static boolean validLength(String pwd)
public static boolean hasUpperCase(String pwd)
public static boolean hasDigit(String pwd)
public static boolean hasSpecialChar(String pwd)
Tips:
I used nest loops for 'hasSpecialChar'. I just put all of the special chars together as 1 String

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 Programming Questions!