Advertisement
INSECURE-FLOWERPOT

Untitled

Feb 17th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. public class Place implements Comparable
  2. {
  3. /**Stores the city.**/
  4. private String city;
  5.  
  6. /**Stores the state.**/
  7. private String state;
  8.  
  9. /**
  10. * This default constructor will assign a "fake" city and state if a city or state was not constructed.
  11. * <P>
  12. * Algorithm:<br>
  13. * 1. Assign the field variables a null or "".<br>
  14. * </P>
  15. */
  16. public Place()
  17. {
  18. ////////////////////////////
  19. /*Put implementation here*/
  20. ///////////////////////////
  21. }
  22.  
  23. /**
  24. * This constructor will assign a specific city and state when constructed.
  25. * <P>
  26. * Algorithm:<br>
  27. * 1. Assign a specific city and state to the field variables.<br>
  28. * </P>
  29. * @param city Passes in the name of the city.
  30. * @param state Passes in the name of the state.
  31. */
  32. public Place(String city, String state)
  33. {
  34. ///////////////////////////
  35. /*Put implementation here*/
  36. ///////////////////////////
  37.  
  38. }
  39.  
  40. /**
  41. * The getCity() method will return the city name that was assigned to the field variable "city".
  42. * <P>
  43. * Algorithm:<br>
  44. * 1. Retrieve the city field and return it.<br>
  45. * </P>
  46. * @return This method returns the city.
  47. */
  48. public String getCity()
  49. {
  50. return null;
  51. }
  52.  
  53. /**
  54. * The getState() method will return the State abbreviation that was assigned to the field variable "state".
  55. * <P>
  56. * Algorithm:<br>
  57. * 1. Retrieve the state field and return it.<br>
  58. * </P>
  59. * @return This method returns the state.
  60. */
  61. public String getState()
  62. {
  63. return null;
  64. }
  65.  
  66. @Override
  67. /**
  68. * The compareTo() method is going to compare two strings in order to see which one comes in order alphabetically.
  69. * <P>
  70. * Algorithm:<br>
  71. * 1. Construct a Place object and cast parameter "temp" to Place.<br>
  72. * 2. Compare the current object "this" to another object "temp"<br>
  73. * 3. After comparison return a -1, 0, or 1 that logically corresponds to the alphabetical order.<br>
  74. * </P>
  75. * @return This method returns an int value of -1, 0, or 1 depending on the alphabetical order of comparison of strings.
  76. */
  77. public int compareTo(Object temp)
  78. {
  79.  
  80. return 0;
  81. }
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement