Advertisement
jdalbey

Climber.java skeleton

Sep 23rd, 2013
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.94 KB | None | 0 0
  1.  
  2. /**
  3.  * A climber is a person who ascends vertical rocks.
  4.  * The difference between a climber's armspan and their height is called
  5.  * their "apeIndex".
  6.  * @author <YOUR NAME HERE>
  7.  * @version Sep 2013
  8.  */
  9. public class Climber
  10. {
  11.  
  12.     private String name;  // the climber's name
  13.     private int apeIndex;  // the climber's ape index
  14.    
  15.     /**
  16.      * Constructor for an empty Climber.
  17.      */
  18.     public Climber()
  19.     {
  20.         this.name = "";
  21.     }
  22.  
  23.     /**
  24.      * Construct a climber with the given attributes.
  25.      *
  26.      * @param  namep the climber's name
  27.      * @param  apeIndexp the climber's apeIndex
  28.      */
  29.     public Climber(String namep, int apeIndexp)
  30.     {
  31.         // PROVIDE METHOD BODY HERE
  32.     }
  33.    
  34.     /**
  35.      * Accessor to climber's name.
  36.      * @return String the name of this climber
  37.      */
  38.     public String getName()
  39.     {
  40.         // PROVIDE METHOD BODY HERE
  41.     }
  42.    
  43.     /**
  44.      * Accessor to climber's apeIndex.
  45.      * @return int the apeIndex of this climber
  46.      */
  47.     public int getApeIndex()
  48.     {
  49.         // PROVIDE METHOD BODY HERE
  50.     }
  51.    
  52.     /** Return whether or not this climber has a long reach.
  53.      * @return true if this climber's apeIndex > 2, false otherwise.
  54.      */
  55.     public boolean hasLongReach()
  56.     {
  57.         // PROVIDE METHOD BODY HERE
  58.     }
  59.    
  60.     /** Return whether or not this climber is empty.
  61.      * @return true if this climber has a name of length zero.
  62.      */
  63.     public boolean isEmpty()
  64.     {
  65.         // PROVIDE METHOD BODY HERE
  66.     }
  67.    
  68.     /** Determine if two climber's are the same.
  69.      * @param other the climber to whom this climber is compared
  70.      * @return true if climber's are equal
  71.      */
  72.     public boolean equals(Object other)
  73.     {
  74.         if (other instanceof Climber)
  75.         {
  76.             Climber candidate = (Climber) other;
  77.             return this.name == candidate.name;
  78.         }
  79.         return false;
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement