Computer Programming Assignment (Java): Assignment: Input and Outp ut Files Writ
ID: 3709000 • Letter: C
Question
Computer Programming Assignment (Java):
Assignment: Input and Output Files
Write a JAVA class Passw0rd (Note that class name has a zero instead of an o).
The class should have a variable String password.
It should have a constructor taking a string as an argument.
It should have a method which checks the password for the following requirements.
public String checkPassword( String psswd)
The password uses the following criteria:
The password should be at least 6 characters strong.
The password should contain at least one upper case letter.
The password should contain at least TWO lower case letters
The password should have at least one digit.
The algorithm should ask for a password and then verifies that it meets the stated criteria. If it does it should return message “Password Accepted”. If not it should return a message as to what is wrong with the password and why it is not accepted.
Create a PasswordTest class. This should read in the given input file passwdin.txt. This input file has six passwords. Your PasswordTest main method should read each password and call the above method with each string as the argument and write the password string and the return argument into an output file passwdout.txt.
So for example if the first password being read from the input file is Myname, then in the output file it should say as the first line
MyName – Password should have at least one digit.
Here is the given input file passwdin.txt.
Explanation / Answer
Hi Dear,
Please find my implementation.
###########
Output:
Password ...
Password - Password should contain at least one digit
Passw0rd ...
Password Accepted
pswd1 ...
pswd1 - Password should be at least 6 characters long, Password shoud contain atleast one upper case letter
1Password! ...
Password Accepted
123456 ...
123456 - Password shoud contain atleast one upper case letter, Password shoud contain atleast two lower case letter
Gr8passwd ...
Password Accepted
Successfully written to file
Process finished with exit code 0
passwordout.txt:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.