/* ResidentialEntry.java 1.0 */ /* by Corky Cartwright */ /* modified by Sharon Tuttle, 2-18-03 */ class ResidentialEntry extends CityEntry { /*--------------------------------------- no additional fields...! ---------------------------------------*/ /*-------------------------------------- constructors ---------------------------------------*/ ResidentialEntry(String nm, String addr, String ph) { // fields name, address, phone are INHERITED from CityEntry // ...and since they're private, they must be modified via // modifier methods this.setName(nm); this.setAddress(addr); this.setPhone(ph); } /*------------------------------------------------------------- overridden methods ---------------------------------------------------------------*/ public String toString() { return "ResidentialEntry[" + this.getName() + ", " + this.getAddress() + ", " + this.getPhone() + "]"; } /*----------------------------------------------------------- implementations of superclass' abstract methods --------------------------------------------------------------*/ /*----------------------------------------------------------- specialToString() Purpose: give a "special" string depiction of a ResidentialEntry, perhaps the cheapest entry that would actually appear in an eventual directory... ---------------------------------------------------------------*/ String specialToString() { return this.getName() + "............" + this.getPhone(); } /*----------------------------------------------------------- specialGetPhone() Purpose: give a "special" string depiction of a phone number, preceded by "Res " for a ResidentialEntry ---------------------------------------------------------------*/ String specialGetPhone() { return "Res " + this.getPhone(); } }