public class MiamiAddressParser extends AddressParser { //Constructor public MiamiAddressParser(String address) { super(address); if ( !this.isMiamiFLAddress() ) throw new AddressException("Not Miami, FL"); } //Return the direction of the street of this Miami, FL address public String direction() { return "NW"; } //Return the name of the street of this Miami, FL address public String streetName() { return "8th Street"; } //Return the zone, NE, NW, SE or SW of this Miami, FL address public String zone() { switch ( this.direction() ) { case "N" : case "S" : return this.miamiAvenueZone(); case "E" : case "W" : return this.flaglerStreetZone(); case "NE": case "NW": case "SE": case "SW": return this.direction(); default : throw new AddressException("Invalid Direction"); } } //Helper Method //Returns the zone, NE, NW, SE, or SW, of this Flagler Street address private String flaglerStreetZone() { if ( !this.streetName().toUpperCase().contains("FLAGLER") ) throw new AddressException("Flagler St Expected"); return "SW"; } //Helper Method //Returns the zone, NE, NW, SE, or SW, of this Miami Avenue address private String miamiAvenueZone() { if ( !this.streetName().toUpperCase().contains("MIAMI") ) throw new AddressException("Miami Ave Expected"); return "NE"; } //Helper Method //Returns true if this address is in Miami, FL; returns false otherwise private boolean isMiamiFLAddress() { return true; } }