How Can I Run Program Like This Question I Have Prove My Code The Program Should

how can i run program like this question i have prove my code

The program should keep looping to prompt the user for input until hitting a sentinel value -1 for either user name or password. For each round of input, the loop calls the above method to check the password validity according to the rules stated above. Hints: for rules (2) to (5), you may use the matches() method of the String class to check for patterns (defined by regular expressions) in the password. Study p.5-7 if you have no ideas. For (6), you can use the contains() or indexOf(String str) method.

First Run

Enter user name: King Enter password: Hello123

# Password is valid. Enter user name: King Tin

Enter password: 45H000 Password should be within 7 to 10 characters in length.

Password should contain at least one lower-case alphabet.

Password should contain at least one special character.

Enter password: %45H abcde Password should not contain whitespace.

Enter password: %45Habcde Password is valid.

Enter user name: Peggy

Enter password: abc456 Password should be within 7 to 10 characters in length.

Password should contain at least one upper-case alphabet.

Password should contain at least one special character.

Enter password: xyZ789@ Password is valid.

Enter user name: Victoria Enter

password: Naughty1234$

Password should be within 7 to 10 characters in length.

Enter password: Lovely123# Password is valid.

Enter user name: -1 (Program exited) Another Run

Enter user name: OneMore Enter password: 78&OneMore Password should not contain or be the same as user name.

Enter password: 78&TwoMore Password is valid. AST10106 Introduction to Programming 11

Enter user name: Last One

Enter password: $Last One

Password should not contain or be the same as user name.

Password should not contain whitespace.

Password should contain at least one number. Enter password: -1

(Program exited)

that’s my code

package test;

import java.util.Scanner;

class PasswordValidator {