Imagine you are developing a software package for Amazon.com that requires users to enter their own passwords. Your software requires that users’ passwords meet the following requirements: The password should be at least 8 characters The password should contain at least one uppercase and at least one lowercase letter The password should contain at least one digit The password should contain at least one of the following symbols: @*#$%? (You may want to create a string containing these characters and use that to check) The password may not contain a blank Write a program that verifies that passwords are valid. Read a series of passwords from an external input file (Scanner), one per line. Remove any leading or trailing blanks. For each password, determine if it is valid by calling a method to test for criteria above. The main method should print each password, and a message that it is valid or not valid. When it is done reading and processing all data input, print a message that the program is ending. Print to an external output (PrintWriter) file. Your data should include at least 12 passwords, though your program doesn’t know how many there will be. Include 2-3 valid passwords, and at least one invalid for each one (and only one) of the above criterion. Have some that are invalid for more than one criterion. Also, include leading or trailing blanks in some of the passwords, and remove them from the password.
Imagine you are developing a software package for Amazon.com that requires users to enter their own passwords. Your software requires that users’ passwords meet the following requirements:
- The password should be at least 8 characters
- The password should contain at least one uppercase and at least one lowercase letter
- The password should contain at least one digit
- The password should contain at least one of the following symbols: @*#$%?
(You may want to create a string containing these characters and use that to check) - The password may not contain a blank
Write a
Read a series of passwords from an external input file (Scanner), one per line. Remove any leading or trailing blanks. For each password, determine if it is valid by calling a method to test for criteria above. The main method should print each password, and a message that it is valid or not valid. When it is done reading and processing all data input, print a message that the program is ending. Print to an external output (PrintWriter) file.
Your data should include at least 12 passwords, though your program doesn’t know how many there will be. Include 2-3 valid passwords, and at least one invalid for each one (and only one) of the above criterion. Have some that are invalid for more than one criterion. Also, include leading or trailing blanks in some of the passwords, and remove them from the password.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images