Hello, I'm learning how to use Java and I am not really understanding what I'm doing. I am trying to create a class (which I'm having trouble understanding alone), but in this class, I'm trying to make a username that contains the first three letters of the first and last name then random numbers after it. Then just a random six digit password. This is what I have so far:
public class UserID {
private static final int MAX = 6;
private String firstName;
private String lastName;
private String user;
private String password;
public UserID (String first, String last){
firstName = first;
lastName = last;
}
public String getId()
/**
*
* @return
*/
{
return user;
}
public String setID()
{
return user;
}
public String getPassword()
{
return password;
}
public boolean setPassword(String pw) {
boolean isSet = true;
if (pw.length() >= 6) {
password = pw;
isSet = false;
}
return isSet;
}
public String generateNewPassword(int pw) {
pw = (int)(Math.random() * MAX) + 1;
return password;
}
public String toString() {
String output = "First name: " + firstName
+ " " + lastName + "\n";
output += "User ID: " + user + "\n";
output += "Password: " + password + "\n";
output += "Would you like to change your password?"
+ "(Y - Yes, N - No) ";
return output;
}
}
I'm not asking for someone to do my homework, but could someone steer me in the right direction and tell me what I'm doing wrong here?
Thank you1