Address.java 949B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Class Address - used to store address details for a post address
  3. *
  4. * @author Michael Kölling
  5. * @version 1.0, January 1999
  6. */
  7. public class Address
  8. {
  9. private String street;
  10. private String town;
  11. private String postCode;
  12. private String country;
  13. /**
  14. * Construct an Address without country
  15. */
  16. public Address(String street, String town, String postCode)
  17. {
  18. this(street, town, postCode, "");
  19. }
  20. /**
  21. * Construct an Address with full details
  22. */
  23. public Address(String street, String town, String postCode, String country)
  24. {
  25. this.street = street;
  26. this.town = town;
  27. this.postCode = postCode;
  28. this.country = country;
  29. }
  30. /**
  31. * Return a string representation of this object.
  32. */
  33. public String toString()
  34. {
  35. return street + "\n" +
  36. town + " " + postCode + "\n" +
  37. country + "\n";
  38. }
  39. }