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

(20 points) Complete the body of main so it prompts the user for a password cand

ID: 670038 • Letter: #

Question

(20 points) Complete the body of main so it prompts the user for a password candidate until either the password candidate is the empty string, or the password candidate is “acceptable” according to isOK. (In our formal specifications, for a mathematical string such as pwd, |pwd| means the length of pwd.)

/** * Checks whether the given string satisfies the criteria for * an acceptable password. *

* @param pwd * the string to check for acceptability

* @requires * |pwd| > 0

* @ensures * isOK = [pwd satisfies the criteria for an acceptable password]

*/

private static boolean isOK(String pwd) {...}

/**

* Main method.

*

* @param args * the command line arguments

*/

public static void main(String[] args) {

SimpleReader in = new SimpleReader1L();

SimpleWriter out = new SimpleWriter1L();

Explanation / Answer


class xyz
{
  
*/
private static boolean isOK(String pwd) {...}
/**
  
public static void main(String[] args)
{
   xyz 0bj = new obj();
SimpleReader in = new SimpleReader1L();
   SimpleWriter out = new SimpleWriter1L();
   Scanner input = new Scanner(System.in);
while(1)
{
System.out.println("Enter Password");
String s = input.nextLine;
if((s.length()==0)|| (obj.isOK(s)))
break;

}
}
}