Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am receiving the following error that I can not figure out for the life of me.

ID: 3639146 • Letter: I

Question

I am receiving the following error that I can not figure out for the life of me. Java:80: class, interface, or enum expected } // end public class password
^

the program is as follows, :80: is the last line

import java.util.Scanner;

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

{String s;
Scanner in = new Scanner(System.in);

System.out.print("Please enter your password");
s=in.next();
if(isGood(s))
System.out.println("Password is valid");
else
System.out.println("Password is invalid: must contain a minimum of" +
"8 characters, 1 upper and lower case letter, 1 didget, and one of" +
"the following special characters: !, @, #, $, %, ^, &, or *");
}

public static boolean isGood(String s)
{if (s.length()>=8&&s.length()>=1&&upper(s)&&lower(s)&&didget(s))
return true;
else
return false;
}

public static boolean upper(String s)
{int i;
for(i=0;i<s.length();i++)
if(Character.isUpperCase(s.charAt(i)))
return true;
return false;
}

public static boolean lower(String s)
{int i;
for(i=0;i<s.length();i++)
if(Character.isLowerCase(s.charAt(i)))
return true;
return false;
}

public static boolean didget(String s)
{int i;
for(i=0;i<s.length();i++)
if(Character.isDidget(s.charAt(i)))
return true;
return false;
}

public static boolean sCharacter(String s);
char trueString(String[] args)
{
boolean isTrue = false;

if ((treuString[0]=='!')&&
(trueString[1]=='@')&&
(trueString[2]=='#')&&
(trueString[3]=='$')&&
(trueString[4]=='%')&&
(trueString[5]=='^')&&
(trueString[6]=='&')&&
(trueString[7]=='*'))
return true;
else
return false;
}

} // end string

} // end public class password

Explanation / Answer

please rate - thanks

in addition to the extra }

you had many other errors which I fixed   especially sCharacter

import java.util.Scanner;

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

{String s;
Scanner in = new Scanner(System.in);

System.out.print("Please enter your password");
s=in.next();
if(isGood(s))
System.out.println("Password is valid");
else
System.out.println("Password is invalid: must contain a minimum of" +
"8 characters, 1 upper and lower case letter, 1 didget, and one of" +
"the following special characters: !, @, #, $, %, ^, &, or *");
}

public static boolean isGood(String s)
{if (s.length()>=8&&s.length()>=1&&upper(s)&&lower(s)&&didget(s))
return true;
else
return false;
}

public static boolean upper(String s)
{int i;
for(i=0;i<s.length();i++)
if(Character.isUpperCase(s.charAt(i)))
return true;
return false;
}

public static boolean lower(String s)
{int i;
for(i=0;i<s.length();i++)
if(Character.isLowerCase(s.charAt(i)))
return true;
return false;
}

public static boolean didget(String s)
{int i;
for(i=0;i<s.length();i++)
    if(Character.isDigit(s.charAt(i)))
           return true;
return false;
}

public static boolean sCharacter(String trueString)
{

for(int i=0;i<trueString.length();i++)
       if ((trueString.charAt(i)=='!')||
                (trueString.charAt(i)=='@')||
                (trueString.charAt(i)=='#')||
                 (trueString.charAt(i)=='$')||
                 (trueString.charAt(i)=='%')||
                (trueString.charAt(i)=='^')||
                (trueString.charAt(i)=='&')||
              (trueString.charAt(i)=='*'))
    return true;
return false;

} // end string

} // end public class password

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote