Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4: Write a program that allows users to choose a new password that matches some rules. The passwords should be at least seven characters

image text in transcribed

Problem 4: Write a program that allows users to choose a new password that matches some rules. The passwords should be at least seven characters long, have an uppercase letter, a lowercase letter, and a digit. The program will ask the user for their password twice. If the passwords entered are different or are invalid, the program will repeat the process until a valid password is chosen. As part of this program, write a method boolean isPasswordValid (String password) which implements the validation logic described above to check if a single password is valid. Example: Choose a new password. It should be at least eight characters long, have both an uppercase and lowercase letter, and have a digit. Enter your new password: hunter2 Enter your new password again: hunter2 Password is invalid, please try again. Enter your new password: Hunter2 Enter your new password again: hunter2 Password is invalid, please try again. Enter your new password: Hunter2 Enter your new password again: Hunter2 Your password is set. Thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions