I need help Developing a Java program that will accept user input, until a strong password is entered. After each user attempt at inputting a password display one of the following messages  • Invalid • Low Security Level • Medium Security Level • Strong Security Level Continue prompting the user until a strong password is entered. Use the criteria listed below to  determine password security level. Low - Each password must have at least 5 characters. This is the default security level. Medium - Each password must have at least 6 characters and meet the following requirements: • Includes numbers and mixed case letters High - Each password must have at least 8 characters and meet the following requirements: • Includes numbers and mixed case letters • Includes a special character that is not a letter or number Invalid - doesn't meet minimum requirements of the low (default) security level. I have code but I keep getting errors that I don't know how to fix. Can you help edit them?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help Developing a Java program that will accept user input, until a strong password is entered. After each user attempt at inputting a password display one of the following messages 
• Invalid
• Low Security Level
• Medium Security Level
• Strong Security Level
Continue prompting the user until a strong password is entered. Use the criteria listed below to 
determine password security level.
Low - Each password must have at least 5 characters. This is the default security level.
Medium - Each password must have at least 6 characters and meet the following requirements:
• Includes numbers and mixed case letters
High - Each password must have at least 8 characters and meet the following requirements:
• Includes numbers and mixed case letters
• Includes a special character that is not a letter or number
Invalid - doesn't meet minimum requirements of the low (default) security level.

I have code but I keep getting errors that I don't know how to fix. Can you help edit them?

import java.util.Scanner;

public class A6LaForce{
public static void main(String [] args){

//to store the user password
String password;
//to store the number of characters in the password
int lenPass;
//to state if password has numerical chracter
boolean containsNum = false ;
//to state if password has any special character
boolean containsSpecialChar = false;
//to state if password has any uppercase character
boolean containsUpperCase = false;
//to state if password is valid(atleast low) . Initialize to false .
boolean isValid = false;
//to state if password is low
boolean isLowLevel = false;
//to state if password is medium .
boolean isMedLevel = false;
//to state if password is High
boolean isHighLevel = false;

//Trap the user until the password is not valid
while(isValid != true){
//Ask for the user password
System.out.println("\nPlease enter valid password : ");
//Take input of password . Create the object of scanner class to take input in java
Scanner sc = new Scanner(System.in);
//Take the input
password = sc.nextLine();

//total characters in the string is length of string
lenPass = password.length();

//Now we have to count the characters in the password
//Iterate over the string
for(int i = 0 ;i<password.length();i++){

//Get the ascii value of character by casting it to the int
int asciiChar = (int)password.charAt(i);
//Check if character is numerical . Ascii for numbers is between 48 to 57
if(asciiChar >= 48 && asciiChar <= 57){
//set flag for numerical to true
containsNum = true;
}
//Check if password have any capital character
if(asciiChar >= 65 && asciiChar <= 90 ){
//set flag for uppercase to true
containsUpperCase = true;
}
//check if password have any special case character
if(!(asciiChar>=97 && asciiChar<=122) && !(asciiChar >= 65 && asciiChar <= 90) && !(asciiChar >= 48 && asciiChar <= 57)){
//If not number nor small case or nor big case then it is special case char
//Hence set the special char flag to true
containsSpecialChar = true;
}
}
//TO check now for the level of the password
if(lenPass >=5){
//set low level password tag to true and valid tag to true
isLowLevel = true;
isValid = true;
}
//If more than or equal to 6 and have number and capital letters then password is medium level
if(lenPass >=6 && containsNum == true && containsUpperCase == true){
//Set the midlevel tag to true and valid tag to true
isMedLevel = true;
isValid = true;
}
//If more than 8 lenth and have number and capital letters and special character then high level
if(lenPass >= 8 && containsNum == true && containsUpperCase == true && containsSpecialChar == true){
//set the high level tag to true and valid tag to true
isHighLevel = true;
isValid = true;
}

//Now we have to provide the result
//If password is valid then enter the conditionals
if(isValid == true){
//Now first conditional for the strong
if(isHighLevel == true ){
//give proper output
System.out.println(" Valid - High security level. ");
}else if(isMedLevel == true && isHighLevel == false){
System.out.println(" Valid - Medium security level ");
}else if(isLowLevel == true && isMedLevel == false && isHighLevel == false){
System.out.println(" Valid - Low security level ");
}
}else{
//If not valid then give the output
System.out.println("Invalid - doesn't meet minimum requirements of the low (default) security level.");
}

}


}
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY