Question: I am having trouble figuring out how to do this code. It was an extra credit assignment that I didn't do but I would really
I am having trouble figuring out how to do this code. It was an extra credit assignment that I didn't do but I would really like to seee this code all typed out with comments so I can have a better understanding. I am an Environmental Engineering major so this computer programing stuff has been very difficult. So, please can someone help me by typing the code that is asked in this assignment with comments. Java.
Write a program to create usernames and validate passwords.
The user will enter their first and last name. Your program should create and print a username, using the following rules:
The username will consist of the last name, followed by the first letter of the first name.
If the resulting username is less than 5 characters in length, then append the second letter of the first name.
Convert the username to lower case.
For example, the username for "James Gary" will be "garyj". The username for "John Doe" will be "doejo".
The user will then select a password. Your program will validate the password using the following rules.
The password must be at least 8 characters long.
The password must contain at least one uppercase letter
The password must contain at least one lowercase letter.
The password must contain at least one digit or punctuation mark.
In addition, the password must not be equal to any password in the file "badpasswords.txt"
You will create the badpasswords.txt file and your program should work for a file of any length. For example, the file might contain:
password1 superman! passw0rd pass1234
Any password entered that matches any of those in the badpasswords.txt file, ignoring case, are rejected. For example, "PassworD1" is rejected as it matches the first line of the file.
Your program should repeat asking for a password until the user enters a valid one and should print a reason for the rejection if their password is not valid.
Most of the difficult parts of this assignment can be solved with proper use of methods in the Java standard library. You should review the methods in the string class at
https://docs.oracle.com/javase/7/docs/api/java/lang/String.html
In particular, the equalsIgnoreCase method should be handy.
There is also a useful class named Character with many methods to classify characters as letters, digits, etc. Review the documentation at
https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html
Your program should be well modularized, well commented, and include reasonable variable names
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
