Can anyone help me with rewriting my pseudocode? Below is thepseudocode, and after that is the completed program.
Pseudocode:
DISPLAY Login information
PROMPT for username/password
output”Enter Username”
inputuserName
output”Enter password: “
inputpassword
//If successful, display information pertaining to the specificuser, as well as prompt for logout
IF User type ‘quit’
Exit Program
VALIDATE User Credentials
IF NOT Validated
Check number of InvalidAttempts
IF user attemptsequal three THEN
DISPLAYerror message
output”You have reached the maximum number of login attempts, pleasecontact your system administrator”
EXITprogram
ELSE
DECREMENTLogin attempts by one
//InformUser of remaining attempts
output”# attempts remaining”
LOOPto VALIDATE Credentials
ENDIF
ELSE
SET Username
MATCH Corresponding Role
DISPLAY Welcome message
ELSE
IF User type ‘quit’
Exit Program
Completed Program:
public static void main(String[] args)throws Exception
{
//Scanner objectthat reads input
ScannerreadInput=new Scanner(System.in);
//Keepstrack of number of attempts
intattempts=0;
while(true)
{
//PROMPTfor username/password
System.out.print(“Enterusername: