Created
May 21, 2011 11:16
-
-
Save justinrolston/984446 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Unit8Project | |
{ | |
public static void main (String[] args) | |
{ | |
String apassword1; | |
String apassword2; | |
Scanner keyboard = new Scanner(System.in); | |
System.out.print("Enter a password: "); | |
apassword1 = keyboard.nextLine(); | |
int apasswordlength; | |
apasswordlength = apassword1.length(); | |
if (apasswordlength >= 6); | |
else System.out.print("The password you entered is invalid, please try again"); | |
if( apassword1.matches(".*[a-zA-Z]+.*")); | |
else System.out.print("The password you entered is invalid, please try again"); | |
if (apassword1.matches(".*[0-9].*")); | |
else System.out.print("The password you entered is invalid, please try again"); | |
System.out.print("Re-enter your password: "); | |
apassword2 = keyboard.nextLine(); | |
if (apassword1.equals(apassword2)) | |
System.out.print("You have successfully created a password"); | |
else | |
System.out.print("The password you entered does not match, please try again"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment