How would I get the accessor method to return the first letter of a name to be uppercase and the rest in lowercase no matter what was entered?
public class Name
{
private String first;
private String last;
/**
* Constructor for objects of class Name
*/
public Name(String firstName, String lastName)
{
first = firstName;
last = lastName;
}
/**
* @returns firstName
*/
public String getFirstname()
{
return first;
}
/**
* @returns lastName
*/
public String getLastname()
{
return last;
}
/**
* @returns Fullname
*/
public String getFullname()
{
return first + last;
}
/**
* @para new firstname
*/
public void setFirstname(String firstName)
{
first = firstName;
}
}