Access Millions of academic & study documents

Password Checker

Content type
User Generated
Subject
Java
School
Keiser University
Type
Homework
Showing Page:
1/4
Running Head: PASSWORD CHECKER 1
Password Checker
Name
Institution
Course Code

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/4
PASSWORD CHECKER 2
// Program to check whether passsword entered contains atleast two uppercase letter, 2 lowercase
and 2 digits
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class ValidatePassword{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter a password
System.out.print("Please enter a password that contains atleast 2 uppercase letter, atleast 2
lowercase letter, and atleast 2 digits: ");
String password = input.nextLine();//Store password in variable named password
List<String> errorList = new ArrayList<String>();//List to store errors
// Loop to continuously promt the user until a valid password is entered
while (!isValid(password, errorList)) {
System.out.println("Sorry, invalid Password:");
for (String error : errorList) {
System.out.println(error);//Print reasons why password is invalid
}
System.out.print("Try Again ");
password = input.nextLine();
}
System.out.println("Valid! Your password is: " + password); //If the password is valid

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/4

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 4 pages?
Access Now
Unformatted Attachment Preview
Running Head: PASSWORD CHECKER 1 Password Checker Name Institution Course Code PASSWORD CHECKER 2 // Program to check whether passsword entered contains atleast two uppercase letter, 2 lowercase and 2 digits import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.Scanner; import java.util.ArrayList; import java.util.List; public class ValidatePassword{ public static void main(String[] args) { Scanner input = new Scanner(System.in); // Prompt the user to enter a password System.out.print("Please enter a password that contains atleast 2 uppercase letter, atleast 2 lowercase letter, and atleast 2 digits: "); String password = input.nextLine();//Store password in variable named password List errorList = new ArrayList();//List to store errors // Loop to continuously promt the user until a valid password is entered while (!isValid(password, errorList)) { System.out.println("Sorry, invalid Password:"); for (String error : errorList) { System.out.println(error);//Print reasons why password is invalid } System.out.print("Try Again "); password = input.nextLine(); } System.out.println("Valid! Your password is: " + password); //If the passwo ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4