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

Design and write a java class \"password\" to encapsulate a password with (at le

ID: 3641970 • Letter: D

Question

Design and write a java class "password" to encapsulate a password with (at least) these three methods:

changePassword ... should accept as a parameter a new password, verify it, and store to the instance variable if valid. if the password passed is invalid, it should output a diagnostic error message to screen and make no change to the instance variable

getPassword... should return the current password. if current password is an empty string ("""), this module fist displays a disagnostic message to screen "no password has been set."

passwdCheck... should accept as aparameter a password to test, verify it against the current password, and return true if password passed is valid, false if not. if current password is an empty string (""), this module first displays a diagnostic message to screen "No password has been set."

CRITERIA FOR VALID PASSWORD
- 6 or more char in length
- at least one uppercase letter
- at least one lowercase letter
- at least one digit

Explanation / Answer

import java.io.*; class EraserThread implements Runnable { private boolean stop; /** *@param The prompt displayed to the user */ public EraserThread(String prompt) { System.out.print(prompt); } /** * Begin masking...display asterisks (*) */ public void run () { stop = true; while (stop) { System.out.print("*"); try { Thread.currentThread().sleep(1); } catch(InterruptedException ie) { ie.printStackTrace(); } } } /** * Instruct the thread to stop masking */ public void stopMasking() { this.stop = false; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote