Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Declare a Boolean variable named goodPassword. Use goodPassword to output Valid if passwordStr contains at least 4 letters and passwordStr's length is less than
Declare a Boolean variable named goodPassword. Use goodPassword to output "Valid if passwordStr contains at least 4 letters and passwordStr's length is less than 11. Otherwise, output "Invalid". Ex: If the input is 83f0025SP7, then the output is: Valid Ex: If the input is kvJBbCTKH8r, then the output is: Invalid Note: Character.isLetter() returns true if a character is a letter, and false otherwise. Ex: Character.isLetter(a) returns true. Character.isLetter(8) returns false. 567 8 9 10 11 12 13 14 15 16 17 18 19 20 public static void main(String[] args) { Scanner scnr new Scanner(System.in); String passwordstr; /* Additional variable declarations go here */ } passwordStr = scnr.nextLine(); /* Type your additional code here / if (goodPassword) { System.out.println("Valid"); } else { } System.out.println("Invalid"); 1 2 3
Step by Step Solution
★★★★★
3.45 Rating (165 Votes )
There are 3 Steps involved in it
Step: 1
Java program that reads a password and displays if the entered password is valid or invalid import j...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