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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!