//Person.java

package javadocsample;

/**
 * A simple class for a person.
 */
public class Person
{
    private String name;


    /**
     * Creates a "default" person.
     */
    public Person()
    {
        name = "No name yet.";
    }

    /**
     * Creates a person with a specified name.
     * @param initialName The person's name.
     */
    public Person
    (
        String initialName
    )
    {
        name = initialName;
    }

    /**
     * Sets the name of the person.
     * @param newName The person's name is changed to newName.
     */
    public void setName
    (
        String newName
    )
    {
        name = newName;
    }

    /**
     * Gets the name of the person.
     * @return The person's name.
     */
    public String getName()
    {
        return name;
    }

    /**
     * Displays the name of the person.
     */
    public void writeOutput()
    {
        System.out.println("Name: " + name);
    }

    /**
     * Tests whether this person has the same name as another person.
     * @return true only if calling object and otherPerson have the same name.
     */
    public boolean sameName
    (
        Person otherPerson
    )
    {
        return (this.name.equalsIgnoreCase(otherPerson.name));
    }
}

