Create a class the asks the user for their name. Loop and call the validateName method that checks the name against the valid name array. If there is a match move on to the next section. If it does not match loop and ask again for the name until there is a match. The validateName method has one String as an argument and returns a Boolean value of true or false. It checks the incoming argument against the array of valid usernames that you create. It should have at least three names. If a valid name is found then return true, else return false.
Once the validate name is passed then the main method will loop again and ask the user for their password. It will then pass the password to the validatcPassWord method that will check the password against the password array. If they match, continue. If they don’t match loop and ask the user to try again. The validate password array should have three valid passwords at least. The same number as valid login names. The validatePassWord method takes one String as an argument and returns a Boolean value. If the incoming String matches one of the passwords in the password array, then return true, otherwise return false. Once the password is validated, display “Login successful” from the main method.

New Download