package examples;

/**
 * @author Ben Wang
 */
public class Address {
   protected String city;
   protected int zip;
   protected String street;

   public void setCity(String city)
   {
      this.city = city;
   }

   public String getCity()
   {
      return this.city;
   }

   public void setZip(int zip)
   {
      this.zip = zip;
   }

   public int getZip()
   {
      return zip;
   }

   public void setStreet(String street)
   {
      this.street = street;
   }

   public String getStreet()
   {
      return this.street;
   }
   
   public String getSimpleAddress()
   {
      StringBuffer buf = new StringBuffer(street);      
      buf.append(" "  + city);
      if (zip > 0)
         buf.append("  " + zip);

      return buf.toString();
   }

   public String toString()
   {
      StringBuffer buf = new StringBuffer();
      buf.append("{City = " +city).append(" ,zip = " +zip).append(" ,street = " +street + "}\n");

      return buf.toString();
   }
}
