Question: /** * Project 4 Comprehensive password tester * @author gcohen */ public class PasswordTester1 { public static void main(String[] args) { String[] passwords = {

 /** * Project 4 Comprehensive password tester * @author gcohen */public class PasswordTester1 { public static void main(String[] args) { String[] passwords= { "abcd", // Wrong size "abcd_defg", // Has non-recognized special character"abcdefgh", // All one case "Abcdefgh1", // Needs a second digit "Abcdefgh12",// Missing a special character "Abcdefgh%12" // Valid }; // Check the

/** * Project 4 Comprehensive password tester * @author gcohen */ public class PasswordTester1 {

public static void main(String[] args) { String[] passwords = { "abcd", // Wrong size "abcd_defg", // Has non-recognized special character "abcdefgh", // All one case "Abcdefgh1", // Needs a second digit "Abcdefgh12", // Missing a special character "Abcdefgh%12" // Valid };

// Check the individual methods first boolean status; String password = passwords[0]; status = CheckPassword.hasValidSize(password); checkResult(password, !status, "Password wrong size test"); password = "abcdefghijk"; status = CheckPassword.hasValidSize(password); checkResult(password, status, "Password size ok test"); password = passwords[1]; status = CheckPassword.hasValidCharacters(password); checkResult(password, !status, "Has invalid character test"); password = passwords[5]; status = CheckPassword.hasValidCharacters(password); checkResult(password, status, "Has valid character test"); password = passwords[2]; status = CheckPassword.hasUpperLowerCase(password); checkResult(password, !status, "All Upper/Lower case test"); password = passwords[5]; status = CheckPassword.hasUpperLowerCase(password); checkResult(password, status, "Mixed Upper/Lower case test"); password = passwords[3]; status = CheckPassword.hasTwoDigits(password); checkResult(password, !status, "No 2+ digit test"); password = passwords[5]; status = CheckPassword.hasTwoDigits(password); checkResult(password, status, "Has 2+ digit test"); password = passwords[4]; status = CheckPassword.hasSpecialCharacters(password); checkResult(password, !status, "No Special Characters test"); password = passwords[5]; status = CheckPassword.hasSpecialCharacters(password); checkResult(password, status, "Has Special Characters test");

// Codes should be 1 greater than index, except for the last one for (int i = 0; i

}

public static void checkResult(String password, boolean status, String testMessage) { if (status) { System.out.printf("PASSED - %15s %s ", password, testMessage); } else { System.out.printf("FAILED - %15s %s ", password, testMessage); } } }

this is the "improved tester he gave us.individual methods first boolean status; String password = passwords[0]; status = CheckPassword.hasValidSize(password);checkResult(password, !status, "Password wrong size test"); password = "abcdefghijk"; status = CheckPassword.hasValidSize(password);checkResult(password, status, "Password size ok test"); password = passwords[1]; status = CheckPassword.hasValidCharacters(password);

In java please

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!