The program should have a main method and another method called passwordChecker. The main method will send the two new passwords to passwordChecker.
//Assignment 06
*/
public static void main[](String[] args) {
String pass= "ICS 111";
System.out.printIn(valPassword(pass));
}
/*
public static boolean valPassword(String password)
{
if(password.length() > 6)
{
if(checkPass(password)
{
return true;
}
else
{
return false;
}
}
else
System.out.print("Too small");
return false;
}
public static boolean checkPass (String password)
{
boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c;
for(int i = 0; i < password.length(); i++)
{
c = password.charAt(1);
if(Character.isDigit(c));
{
hasNum = true;
}
else if(Character.isUpperCase(c))
{
hasCap = true;
}
else if(Character.isLowerCase(c))
{
hasLow = true;
}
} return true;
{
return false;
}
}
![Type your current password: ICS111
Type a new password: Secret Password!
Retype the new password: Secret Password!
Your new password can not have spaces.
Your password was not changed.
Type your current password: ICS111
Type a new password: SecretPassword
Retype the new password: SecretPassword
Your new password must contain ! or $ or ?.
Your password was not changed.
The program should have a main method and another method called passwordChecker.
The main method will send the two new passwords to passwordChecker.
The main method of the program will:
1. Print "Type your current password:" and accept user input.
2. Check the user input against a current password (test against the string "ICS111").
a. If the user input does not match the current password, print "Password not
recognized." and end.
b. If the user input does match the current password, continue to the next
step.
3. Print "Type a new password:" and accept user input.
4. Print "Retype the new password:" and accept user input.
5. Send the two new passwords to a boolean method named passwordChecker.
a. If passwordChecker returns true, print "Your password was changed to: "
followed by the new password.
b. If passwordChecker returns false, print "Your password was not changed."
6. End of program.
The passwordChecker method will:
1. Receive the two versions of a new password.
2. Set a boolean return value to false.
3. Compare the two passwords to be sure they match.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fef8944c1-efd3-4b85-a18e-90880dd3e09b%2Fb92e29dc-5de3-4444-b5fd-0a4a1f6c6fe5%2Fpsi3xya_processed.png&w=3840&q=75)
![Type your current password: ICS111
Type a new password: SecretPassword!
Retype the new password: SecretPassword!
Your password was changed to: SecretPassword!
In order for the password to be changed:
a. the two new passwords must match
b. The new password must have 6 or more characters
c. The new password must contain no spaces
d. The new password must contain at least one of the following characters: ! or $ or
?
If the new password is acceptable, then the program will say that is has changed
the password. If any of the rules are violated, the program will tell the user what's wrong
and not change the password.
Here are examples of several unsuccessful runs: (user input is in bold):
Type your current password: ICS141
Password not recognized.
Your password was not changed.
Type your current password: ICS111
Type a new password: shhh
Retype the new password: shhh
Your new password must contain 6 or more characters.
Your password was not changed.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fef8944c1-efd3-4b85-a18e-90880dd3e09b%2Fb92e29dc-5de3-4444-b5fd-0a4a1f6c6fe5%2Fe5c4e7c_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.](https://www.bartleby.com/isbn_cover_images/9781337569798/9781337569798_smallCoverImage.gif)