Question
Write Java program to allow the user to input his/her password twice. Then the program will show if the password is accepted. If both input
Write Java program to allow the user to input his/her password twice. Then the program will show if the password is accepted. If both input are similar and the password length is between 8 and 16, then the password will be accepted else the password will be refused and the program print the specific error message.
Typical run of the program
Scenario 1
Enter your password:
password1
Enter your password again:
password2
The password is not accepted
Passwords do not match!
Scenario 2
Enter your password:
pass
Enter your password again:
pass
The password is not accepted
The password length must be between 8 and 16
Scenario 3
Enter your password:
pass1
Enter your password again:
pass2
The password is not accepted
Passwords do not match!
Scenario 4
Enter your password:
password1
Enter your password again:
password1
The password is accepted
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started