Im tryingto write a program that accepts a user's password from the key board. The password needs to be more than 6 characters and less than 10 with at least 1 number and 1 letter or it won't let the user move on. Then once it meets those requirements they have to re-enter the passord, and not let them move on untill the two match. The problem I'm having is I can get the user to type in a passowrd but I don't know how to make them use at least one letter and one number and not let them go on untill they do. Any help would be appreciated.
Think about the process. You have to wait until the user hits enter to be able to validate it.
So once you have the String from the user some simple method calls to String will determine whether it is valid. Does this sound like it should be its own method that returns the result of its validity?
If it is not valid(returns false), then what mechanism exists that will allow you to repeat the process?
Hopefully, this can help you on your way.
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad: