public class DirectoryEntry { // Data Fields /**The name of the individual represented in the entry. */ private String name; /** The phone number for this individual. */ private String number; // Constructor /** Creates a new DirectoryEntry with the specified name and number @param name The name of this individual @number The phone number for this indvidual */ public DirectoryEntry(String name, String number) { this.name = name; this.number = number; } //Methods /** Retrieves the name. @return The name */ public String getName() { return name; } /** Retrieves the number. @return The number. */ public String getNumber() { return number; } /** Sets the number to the specified value @param number The new value for the number */ public void setNumber(String number) { this.number = number; } /** Determines whether two entries contain the same name. The number fields are not compared. @param other The other object @return true If the other object is a DirectoryEntry and it contains the same name. */ public boolean equals(Object other) { if (other instanceof DirectoryEntry) { DirectoryEntry directoryEntry = (DirectoryEntry) other; return name.equals(directoryEntry.name); } else { return false; } } }