Write Java program:
| • Is at least 8 characters long • Contains at least 1 lower letter character • Contains at least 1 upper letter character • Contains at least 1 numeric digit • Contains at least 1 special character from the set: !@#$%^&* • Does not contain the word “and” or the word “the” Prompts the user for a password, including the requirements above in your output. Output a string that states valid or invalid. If invalid, state which rules from the list above have not been met, and prompt the user to enter another password. Utilize the following functionality: • indexOf • Looping structure • charAt() • isDigit() • isUpperCase() • isLowerCase() • and any additional functionality needed |
PasswordChecker.java
import java.util.*;
class PasswordChecker
{
public static boolean isValid(String password)
{
String symbol = "!@#$%^&*";
int upperCaseCount = 0;
int lowerCaseCount = 0;
int digitCount = 0;
boolean hasSymbol = false;
if(password.length() >= 8) {//Checks for length.
int i = 0;
while( i < password.length()) //For each character.
{
char c = password.charAt(i);
if(Character.isUpperCase(c) ) //If uppercase, increment
counter.
upperCaseCount++;
if(Character.isLowerCase(c)) //If lowercase, increment
counter.
lowerCaseCount++;
if(Character.isDigit(c)) //If digit, increment counter.
digitCount++;
if(symbol.indexOf(c) != -1 && hasSymbol == false) //If has
symbol, mark flag.
hasSymbol = true;
i++;
}
} else {
System.out.println("Invalid password. Password length should be no
less than 8.");
return false;
}
if(upperCaseCount < 1) {
System.out.println("Invalid password. Password should contain
minimum 1 uppercase letter.");
return false;
}
if(lowerCaseCount < 1) {
System.out.println("Invalid password. Password should contain
minimum 1 lowercase letter.");
return false;
}
if(digitCount < 1) {
System.out.println("Invalid password. Password should contain
minimum 1 digits.");
return false;
}
if(!hasSymbol) {
System.out.println("Invalid password. Password should contain
atleast one special characters from ! @ # $ % ^ & * ");
return false;
}
return true;
}
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
System.out.print("Ennter the password: ");
String pass = scan.next();
while(!isValid(pass)){
System.out.print("Ennter the
password: ");
pass = scan.next();
}
System.out.println("Given password is valid");
}
}
Output:
Ennter the password: pass
Invalid password. Password length should be no less than 8.
Ennter the password: password
Invalid password. Password should contain minimum 1 uppercase
letter.
Ennter the password: Password
Invalid password. Password should contain minimum 1 digits.
Ennter the password: Password12
Invalid password. Password should contain atleast one special
characters from ! @ # $ % ^ & *
Ennter the password: Password12!@
Given password is valid
Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter charact...
Please make this Python code execute properly. User needs to create a password with at least one digit, one uppercase, one lowercase, one symbol (see code), and the password has to be atleast 8 characters long. try1me is the example I used, but I couldn't get the program to execute properly. PLEASE INDENT PROPERLY. def policy(password): digit = 0 upper = 0 lower = 0 symbol = 0 length = 0 for i in range(0, len(password)): if password[i].isdigit(): # checks...
FOR JAVA: Summary: Write a program to assess password stringency. The solution should be named Password.java. Include these steps: Write an application that provides the criteria for a strong password, and accepts a user's password from an input dialog box. If the entered password is less than six characters, more than 10 characters, or does not contain at least one uppercase letter and one digit, prompt the user to enter again. When the user's entry meets all the password requirements,...
Password Validation Write a program called PasswordValidationYourLastName that validates a new password, following these guidelines: Must be at least 8 characters Must have at least 1 uppercase letter Must have at least 1 lowercase letter Must have at least 1 digit Write a program that asks for a password, and then asks again to confirm it (you can use the scanner or JOptionPane). Pass those two Strings to a method called validatePassword( ). Your validatePassword( ) should return a boolean...
Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...
Write a program that asks the user to enter a password, and then checks it for a few different requirements before approving it as secure and repeating the final password to the user. The program must re-prompt the user until they provide a password that satisfies all of the conditions. It must also tell the user each of the conditions they failed, and how to fix it. If there is more than one thing wrong (e.g., no lowercase, and longer...
please help me out and input values please .. main cpp..
please follow intructions exactly witj clarity please
CSE 110-Intro to Computer Programming Project #3 Requirements-String Class Functions and Test Case Documentation Using the String Class, design and develop a multi-file password validation program and Test case Document (10% of grade) that requests a password, and validates it based on the following criteria. The password must be at least 8 characters long, contain at least one number, and at least...
C++ Loops homework Prompt the user for a desired password, input the password. Your program may assume without checking that there is no input failure and that the password contains no white space. Let's say the rules for a legal password are: # chars must be in [4, 8] # digs must be >= 2 The password must contain at least one letter of each case The password must contain at least one char that's not a letter or digit...
Today you are to write a Java program that will prompt for and
read 2 words of equal length entered by the user, and create a new
word which contains the last letter of the 1st word, the last
letter of the 2nd word, followed by the second to last character of
the 1st word, followed by the second to last character of the 2nd
word and so on. Be sure to use the same format and wording as in...
A CERTAIN program to user's password containing rules such as
least n length, one uppercase, lowercase, one digit and white space
is given as the code down below. So, simiiar to those rules, I need
the code for the following questions post in pictures such as no
more three consecutive letters of English alphabets, password
should not contain User name and so on.
//GOAL: To learn how to create that make strong passwords
//Purpose: 1)To learn some rules that makes...