/* Entry.java 1.1 2-4-03 */ /* modified by S. Tuttle */ /* (modified from example by C. Cartwright) */ class Entry { /* fields */ String name; String address; String phone; /* constructors */ Entry(String nm, String addr, String ph) { this.name = nm; this.address = addr; this.phone = ph; } Entry(String nm) { this.name = nm; this.address = "unknown"; this.phone = "unknown"; } /* accessors */ String getName() { return this.name; } String getPhone() { return this.phone; } String getAddress() { return this.address; } /* modifiers */ void setName(String nm) { this.name = nm; } void setPhone(String ph) { this.phone = ph; } void setAddress(String addr) { this.address = addr; } /* override the inherited version of this method */ public String toString() { return "Entry[" + this.name + ", " + this.address + ", " + this.phone + "]"; } /* other methods */ /*-------------------------------------------------------------- Purpose: determines if this Entry's name matches keyName --------------------------------------------------------------*/ boolean match(String keyName) { return (this.name).equals(keyName); } }