Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock

Java program that reads a password and displays if the entered password is valid or invalid import j... View full answer

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!