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

3.Create a class called Password that represents the password for a user account

ID: 3667532 • Letter: 3

Question

3.Create a class called Password that represents the password for a user account. The class should have at least one string data member representing the password and the following member functions:

A constructor that creates an empty password.

Get function that returns the current password.

Set function that changes the current password to a given string. This function should not change the password if the new string is less than 8 characters in length or if the new string is the same as the previously set password. A new data member may be required to implement this!

Explanation / Answer

private String pass;

public void setpass(String pass) throws Exception{
if(!(pass.equals("")||pass=="")){
this.pass = pass;
}
}
public String getpass(){
return this.pass;
}
public void setpass(string pass) throws Exception{
this.pass = string;
}
public int getpass(){
return this.pass;
}

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