ok here is my code
public class Password_Verifier {
private static String password;
private static int num1=0;
private static int num2=0;
private static int num3=0;
public Password_Verifier(String string) {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
String output = "";
for (int i = 0; i < password.length(); i++){
if (Character.isUpperCase(password.charAt(i)))
{
num1++;
}
if(Character.isLowerCase(password.charAt(i)))
{
num2++;
}
if(Character.isDigit(password.charAt(i)))
{
num3++;
}
}
if (password.length()<6)
{
output = output + "nThe password should be at least six characters long";
}
if (num1 < 1)
{
output = output + "nThe password should contain at least one uppercase letter";
}
if (num2 < 1)
{
output = output + "nThe password should contain at least one lowercase letter";
}
if (num3 < 1)
{
output = output + "nThe password should have at least one digit";
}
if(password.length()>=6 && num1 > 1 && num2 > 1 && num3 > 1 )
{
output = "Password Accepted";
}
}
}
here is the password input
import java.util.Scanner;
public class Password_Input {
public static void main(String[] args) {
Scanner Kb = new Scanner(System.in);
// put in password to test it
System.out.print("Please enter your password: ");
String password =Kb.nextLine();
boolean valid = false;
for (int i = 0; i < password.length(); i++){
char c = password.charAt(i);
do
{
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9'))
{
valid = true;
}
else
{
valid = false;
System.out.print("Only letter or digits are acceptable. Please try again: ");
password = Kb.nextLine();
}
}while(valid =! true);
}
String password1;
Password_Verifier password_Verifier = new Password_Verifier(
password1 = password
);
System.out.println(password_Verifier);
}
}
now the problem i am having is trying to get output to print i already have the code for the input password but i get gibberish my idea was trying to call out output from the main method and having it return does anyone have any good ideas what i want is for my code to return out put to my input part of the code
