Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description: Some websites impose certain rules for passwords. Suppose password rules are as follows: 1. A password must have at least eight characters. 2.

image text in transcribed

Problem Description: Some websites impose certain rules for passwords. Suppose password rules are as follows: 1. A password must have at least eight characters. 2. A password consists of only letters and digits. 3. A password must contain at least two digits. Write a program with class name CheckPassword that prompts the user to entera password and displays Valid password if the rules are followed or Invalid password otherwise. Create three methods (headers given below) to check the three rules. public static boolean AtLeast8(String p) public static boolean LetterOrDigit(String p) public static boolean AtLeast2Digits(String p) 4. Create a method AtLeast8 outside the main method with the header provided in For example, method AtLeast8 will return true if there are at least eight characters in the password otherwise it will return false. the problem description. The password is passed to the string variable p in this method. Inside the method do the following. Here are four sample runs: i) If the length of p is less than 8 then return false, otherwise return true. Enter your password: My password18 Invalid password Sample 2 Enter Invalid password your password: pass18 Sample 3 Enter your password: password Invalid password Sample 4 Enter your password: password18 Valid password You can use the following steps in your code: System.out.print"Enter your password:")

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

More Books

Students also viewed these Databases questions

Question

suggest a range of work sample exercises and design them

Answered: 1 week ago