Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Place implements Comparable
- {
- /**Stores the city.**/
- private String city;
- /**Stores the state.**/
- private String state;
- /**
- * This default constructor will assign a "fake" city and state if a city or state was not constructed.
- * <P>
- * Algorithm:<br>
- * 1. Assign the field variables a null or "".<br>
- * </P>
- */
- public Place()
- {
- ////////////////////////////
- /*Put implementation here*/
- ///////////////////////////
- }
- /**
- * This constructor will assign a specific city and state when constructed.
- * <P>
- * Algorithm:<br>
- * 1. Assign a specific city and state to the field variables.<br>
- * </P>
- * @param city Passes in the name of the city.
- * @param state Passes in the name of the state.
- */
- public Place(String city, String state)
- {
- ///////////////////////////
- /*Put implementation here*/
- ///////////////////////////
- }
- /**
- * The getCity() method will return the city name that was assigned to the field variable "city".
- * <P>
- * Algorithm:<br>
- * 1. Retrieve the city field and return it.<br>
- * </P>
- * @return This method returns the city.
- */
- public String getCity()
- {
- return null;
- }
- /**
- * The getState() method will return the State abbreviation that was assigned to the field variable "state".
- * <P>
- * Algorithm:<br>
- * 1. Retrieve the state field and return it.<br>
- * </P>
- * @return This method returns the state.
- */
- public String getState()
- {
- return null;
- }
- @Override
- /**
- * The compareTo() method is going to compare two strings in order to see which one comes in order alphabetically.
- * <P>
- * Algorithm:<br>
- * 1. Construct a Place object and cast parameter "temp" to Place.<br>
- * 2. Compare the current object "this" to another object "temp"<br>
- * 3. After comparison return a -1, 0, or 1 that logically corresponds to the alphabetical order.<br>
- * </P>
- * @return This method returns an int value of -1, 0, or 1 depending on the alphabetical order of comparison of strings.
- */
- public int compareTo(Object temp)
- {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement