/* BusinessEntry.java 1.0 */ /* by Corky Cartwright */ /* modified by Sharon Tuttle, 2-18-03 */ class BusinessEntry extends CityEntry { /*--------------------------------------- fields ---------------------------------------*/ String city; String state; /*-------------------------------------- constructors ---------------------------------------*/ BusinessEntry(String nm, String addr, String ph, String cty, String st) { // 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); this.city = cty; this.state = st; } /*------------------------------------------------------- accessors -------------------------------------------------------*/ String getCity() { return this.city; } String getState() { return this.state; } /*------------------------------------------------------------- overridden methods ---------------------------------------------------------------*/ public String toString() { return "BusinessEntry[" + this.getName() + ", " + this.getAddress() + ", " + this.getPhone() + ", " + this.city + ", " + this.state + "]"; } /*----------------------------------------------------------- implementations of superclass' abstract methods --------------------------------------------------------------*/ /*----------------------------------------------------------- specialToString() Purpose: give a "special" string depiction of a BusinessEntry, perhaps the cheapest entry that would actually appear in an eventual directory... ---------------------------------------------------------------*/ String specialToString() { return this.getName() + "....." + this.city + " " + this.getPhone(); } /*----------------------------------------------------------- specialGetPhone() Purpose: give a "special" string depiction of a phone number, preceded by the city name for a BusinessEntry ---------------------------------------------------------------*/ String specialGetPhone() { return this.getCity() + " " + this.getPhone(); } }