import java.util.*; import java.lang.*; /** * To output whether a students password is valid or not. * * @author (Sean) * @version (December 13, 2010) */ class SemesterProject { public static void main(String[]args)throws Exception { Scanner scanReader = new Scanner(System.in); String password = ""; int length; int passwordLength; int minimumCharacters = 12; int maximumCharacters = 25; int countCaps = 0; int countLowerCase = 0; int numbers = 0; int specialCharacters = 0; System.out.println("This was made by Sean"); System.out.print("Please enter a password to be checked for validity: "); password = scanReader.nextLine (); passwordLength = password.length (); try { if (passwordLength == 12) { System.out.println("Your pasword meets the length requirments"); } else { throw new Exception (); } } catch (Exception ex) { System.out.println("Please Re-enter a valid password: "); password = scanReader.nextLine (); } } }
I need my program to tell whether the password meets the requirements (12 characters). Ive gotten it to print the request for in put and when it is inputed with a 12 character word it says it meets the requirements. When the incorrect amount of charactersis input it says to reenter a valid amount of characters. But then it wont reiterate after a new one is input. Could someone please help?
Thanks
Sean137