package cart; //Address //author - Lawrence Truett - FluffyCat.com //date - August 12, 2003 - San Diego, CA public class Address { private String street1; private String street2; private String city; private State state; private Zip zip; private Country country; private static final Country countryOfUSA = new Country("USA"); public Address() { this.setStreet1(""); this.setStreet2(""); this.setCity(""); this.setState(new State()); this.setZip(new Zip()); this.setCountry(new Country()); } public Address(String street1In, String street2In, String cityIn, State stateIn, Zip zipIn, Country countryIn) { this.setStreet1(street1In); this.setStreet2(street2In); this.setCity(cityIn); this.setState(stateIn); this.setZip(zipIn); this.setCountry(countryIn); } //version for all strings in public Address(String street1In, String street2In, String cityIn, String stateIn, String zipIn, String countryIn) { this(street1In, street2In, cityIn, new State(stateIn), new Zip(zipIn), new Country(countryIn)); } //USA centric constructor, constructs address with a country of USA public Address(String street1In, String street2In, String cityIn, State stateIn, Zip zipIn) { this(street1In, street2In, cityIn, stateIn, zipIn, countryOfUSA); } //USA centric version for all strings in public Address(String street1In, String street2In, String cityIn, String stateIn, String zipIn) { this(street1In, street2In, cityIn, new State(stateIn), new Zip(zipIn)); } public String getStreet1() {return street1;} public void setStreet1(String street1In) { this.street1 = street1In; } public String getStreet2() {return street2;} public void setStreet2(String street2In) { this.street2 = street2In; } public String getCity() {return city;} public void setCity(String cityIn) { this.city = cityIn; } public State getState() {return state;} public void setState(State stateIn) { this.state = stateIn; } public Zip getZip() {return zip;} public void setZip(Zip zipIn) { this.zip = zipIn; } public Country getCountry() {return country;} public void setCountry(Country countryIn) { this.country = countryIn; } public boolean isValid() { if ( (null != getStreet1()) && (getState().isValid()) ) { return true; } else { return false; } } //method used for data input public boolean isValidOrNull() { if ( (getState().isValidOrNull()) ) { return true; } else { return false; } } }