Buddy Baker 100 Apple Road Big City, UT 99930
Contact (with five ivars) name street city state zip
public void printMailingLabel() { prn(this.name); prn(this.street); prn(this.city); prn(","); prn(this.state); prn(this.zip); }
USAddress street city state zip }
Contact (one ivar - a component) name address (type USAddress)
public void printMailingLabel() {
prn(this.name);
prn(this.address.toMailingString());
}
public class Contact { private String name; private USAddress address; //etc (more code follows) }
public String getStreet() public String getCity() public String getState() public String getZip() public String toMailingString()
public class Contact { private String name; private USAddress address; public void printMailingLabel() { prn(this.name); prn(this.address.toMailingString()); } //etc (more code follows) }