Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the program in java and comment what each line of code does please. Write a program that allows users to choose a new password

Write the program in java and comment what each line of code does please.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions