1 57 58 63 64 package addressbook.wsiftypes; 65 66 import java.io.Serializable ; 67 68 public class Address implements Serializable { 69 70 private int streetNum; 72 private java.lang.String streetName; 73 private java.lang.String city; 74 private java.lang.String state; 75 private int zip; 76 private Phone phoneNumber; 77 78 public Address () { } 80 81 public Address (int streetNum, java.lang.String streetName, java.lang.String city, java.lang.String state, int zip, Phone phoneNumber) { 82 this.streetNum = streetNum; 83 this.streetName = streetName; 84 this.city = city; 85 this.state = state; 86 this.zip = zip; 87 this.phoneNumber = phoneNumber; 88 } 89 90 public int getStreetNum() { 91 return streetNum; 92 } 93 94 public void setStreetNum(int streetNum) { 95 this.streetNum = streetNum; 96 } 97 98 public java.lang.String getStreetName() { 99 return streetName; 100 } 101 102 public void setStreetName(java.lang.String streetName) { 103 this.streetName = streetName; 104 } 105 106 public java.lang.String getCity() { 107 return city; 108 } 109 110 public void setCity(java.lang.String city) { 111 this.city = city; 112 } 113 114 public java.lang.String getState() { 115 return state; 116 } 117 118 public void setState(java.lang.String state) { 119 this.state = state; 120 } 121 122 public int getZip() { 123 return zip; 124 } 125 126 public void setZip(int zip) { 127 this.zip = zip; 128 } 129 130 public Phone getPhoneNumber() { 131 return phoneNumber; 132 } 133 134 public void setPhoneNumber(Phone phoneNumber) { 135 this.phoneNumber = phoneNumber; 136 } 137 138 public boolean equals(Address rhs) { 139 return this.streetNum == rhs.getStreetNum() 140 && this.streetName.equals(rhs.getStreetName()) 141 && this.city.equals(rhs.getCity()) 142 && this.state.equals(rhs.getState()) 143 && this.zip == rhs.getZip() 144 && this.phoneNumber.equals(rhs.getPhoneNumber()); 145 } 146 147 public String toString() { 148 return "streetNum=" + streetNum + "\n" + 149 "streetName=" + streetName + "\n" + 150 "city=" + city + "\n" + 151 "state=" + state + "\n" + 152 "zip=" + zip + "\n" + 153 "phoneNumber=" + phoneNumber; 154 } 155 156 } 157 | Popular Tags |