Question: JAVA Using the draw.io site or a flowcharting tool of your choice, build a flowchart that models a complete Java program called PasswordChecker that gets
JAVA
Using the draw.io site or a flowcharting tool of your choice, build a flowchart that models a complete Java program called PasswordChecker that gets a String from the user at the command line and checks whether the String, called inputPassword, conforms to the password policy. The flowchart should be sufficiently detailed and follow the standards we've showcased in our course.
The password policy is:
Must be 3 characters in length
Must include at least one uppercase character
Must include at least one digit
If the password conforms to the policy, output "The provided password is valid." Otherwise output "The provided password is invalid. Please try again". A loop is not needed for this program.
Submission
Submit a Word (.doc or .docx) or PDF of a captured image of your flowchart.
package passwordchecker;
import java.util.Scanner;
public class PasswordChecker {
public static void main(String[] args) {
// TODO code application logic here
Scanner scnr= new Scanner (System.in);
//variables
String password="";
int passwordLength=0;
boolean passwordDigit=false;
boolean passwordUpperCase=false;
boolean passwordThreeCharacters=false;
//display
System.out.println("Please enter your password");
password=scnr.nextLine();
//(if/else statements)
if (password.length()==3){
passwordThreeCharacters =true;
if (Character.isUpperCase(password.charAt(0))){
passwordUpperCase=true;
}
if (Character.isUpperCase(password.charAt(1))){
passwordUpperCase=true;
}
if (Character.isUpperCase(password.charAt(2))){
passwordUpperCase=true;
}
if(Character.isDigit(password.charAt(0))){
passwordDigit=true;
}
if(Character.isDigit(password.charAt(1))){
passwordDigit=true;
}
if(Character.isDigit(password.charAt(2))){
passwordDigit=true;
}
}
//printout the statements
if (passwordThreeCharacters==true && passwordDigit==true &&passwordUpperCase==true){
System.out.println("The provided password is valid");
}
else{
System.out.println(" The provided password is invalid becasue it must be three characters in length and include at least one digit and at least one uppercase character.Please try again");
}
}
}
//end
not sure how to do the diagram please help thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
