Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the description of the program I need to do. It is in Java Problem Descr

ID: 3629434 • Letter: H

Question

Here is the description of the program I need to do. It is in Java

Problem Description:
Some Websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rule is as follows:

• A password must have at least eight characters.
• A password consists of only letters and digits.
• A password must contain at least two digits.

Write a program that prompts the user to enter a password and displays "valid password" if the rule is followed or "invalid password" otherwise.

Sample 1
Enter a string for password: wewew43x
valid password

Sample 2
Enter a string for password: 343a
invalid password


Analysis:
(Describe the purpose, processing, input and output in your own words.)











Design:
(Describe the major steps for solving the problem.)









Testing: (Describe how you test this program)

Explanation / Answer

please rate - thanks

import java.util.Scanner;
public class ValidPassword
{
public static void main (String[] args)
{String word;
boolean a,b,c,d,e,f;
Scanner input = new Scanner(System.in);
System.out.print("Enter a string for password: ");
word=input.next();
if (len(word) && letter(word) && number(word))
         System.out.println("valid password");
else
         System.out.println("invalid password");

}

public static boolean len(String s)
   {int i;
    if(s.length()>=8)
         return true;
    return false;
       
   }

public static boolean letter(String s)
   {int i;
    for(i=0;i<s.length();i++)
      if (!Character.isLetter(s.charAt(i))&&!Character.isDigit(s.charAt(i)))
            return false;
      return true;
   }

public static boolean number(String s)
   {int i,n=0;
    for(i=0;i<s.length();i++)
      if (Character.isDigit(s.charAt(i)))
              n++;
if(n<2)
      return false;
return true;       
}

}