Question
IN JAVA please help: Often when you create a new password online, the webpage will ensure that your username does not contain special characters. It
IN JAVA please help:
Often when you create a new password online, the webpage will ensure that your username does not contain special characters. It will also ensure that the password you typed in is what you think by asking twice (since it is typically masked by ********):
Write a program that prompts the user for three words
i. User ID
ii. Password
iii. Same password again
Check to see if the User ID contains between 6 and 10 characters inclusive (i.e., usernames including 6 or 10 characters are still OKAY)
i. If the user id is too short, display a message box stating so
ii.If the user id is too long, display a message box stating so Check to make sure that your username DOES NOT contain the following special character: & i.
iii.If the user id contains a special character, display a message box stating so
(HINT: Remember the return value of String.indexOf() if it does not find what it is looking for? Alternatively, you can use the String.contains() method) Check also to see if both passwords match
i. HINT: String pw1, pw2; pw1.equals(pw2); // Will return True or False
ii. HINT: DO NOT Use pw1 == pw2, it will not work as you expect) Display Welcome dgriss (assuming dgriss was the User ID) if all your checks were correct. HINT: You should only see one dialog box after you input the user id and two passwords: either an error popup, or a Welcome popup.
So your program should have the form: if (userId less than 6 characters) { // Error Message } else if (userId greater than 10 characters { // Error Message } else if (userId does not contain &) { // Error Message } else if (password does not equal passwordRepeat) { // Error Message } else { // Welcome message }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started