Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Submit the code and outputs for different passwords . in Java with BlueJ PasswordDemo.java PasswordVerifier_Template.txt import java.util.Scanner; /** * Chapter 8 * Programming Challenge 5:
Submit the code and outputs for different passwords. in Java with BlueJ
PasswordDemo.java PasswordVerifier_Template.txt
import java.util.Scanner; /** * Chapter 8 * Programming Challenge 5: Password Verifier * This program demonstrates the PasswordVerifier class. */ public class PasswordDemo { public static void main(String[] args) { String input; // To hold input // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Get a password. System.out.print("Enter a password: "); input = keyboard.nextLine(); // Check the password. if (!PasswordVerifier.isValid(input)) System.out.println("Invalid password."); else System.out.println("Valid password."); } }
/** * Chapter 8 * Programming Challenge 5: Password Verifier * The PasswordVerifier class stores data about * a user's password. */ public class PasswordVerifier { // Constant for minimum password length public static final int MIN_PASSWORD_LENGTH = 6; /** * isValid method */ public static boolean isValid(String str) { boolean status; // Validity status if (str.length() >= MIN_PASSWORD_LENGTH && hasUpperCase(str) && hasLowerCase(str) && hasDigit(str)) status = true; else status = false; return status; } /** * hasUpperCase method */ private static boolean hasUpperCase(String str) { //insert code here } /** * hasLowerCase method */ private static boolean hasLowerCase(String str) { //insert code here } /** * hasDigit method */ private static boolean hasDigit(String str) { //insert code here } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started