1 /**
2 Describes a mailing address.
3 */
4 public class Address
5 {
6 private String name;
7 private String street;
8 private String city;
9 private String state;
10 private String zip;
11
12 /**
13 Constructs a mailing address.
14 @param aName the recipient name
15 @param aStreet the street
16 @param aCity the city
17 @param aState the two-letter state code
18 @param aZip the ZIP postal code
19 */
20 public Address(String aName, String aStreet,
21 String aCity, String aState, String aZip)
22 {
23 name = aName;
24 street = aStreet;
25 city = aCity;
26 state = aState;
27 zip = aZip;
28 }
29
30 /**
31 Formats the address.
32 @return the address as a string with three lines
33 */
34 public String format()
35 {
36 return name + "\n" + street + "\n"
37 + city + ", " + state + " " + zip;
38 }
39 }
40