• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Using Comparable Interface

I'm having trouble writing code that will take in an object and compare the objects based on a return from my getScore method.  Any help is appreciated.  Any additional information can be given on request also.

     public class ShortStirrupRider implements Rider1, Comparable <Rider1>
   {
       public ShortStirrupRider(String nameofRider, String typeofPony,double heightofFence,double overallScore)
      {
         Rider = nameofRider;
         Pony = typeofPony;
         Fence = heightofFence;
         Score = overallScore;
      }
       public int compareTo(Object Rider1)
      {
      Rider1
       public String toString(){
         String output = "Name: " + nameofRider + "\n" +
            "Type of Pony: " + typeofPony +"%\n" +
            "Fence Height:" + heightofFence + "\n" +
            "Overall Score: " + overallScore + "\n";
         return output;
     
     
     
      }
   }
public class Rider1 implements ShortStirrupRider, LongStirrupRider
   {
   
   
       public int setScore();
      {
      }
       public int getScore();
      {
      }
       public int setHeight();
      {
         double height;
         private static final int inch = 4;
         private static final int hand = 1;
         double equineHeight;
      	
      	
      	
         
      	
         
      }
   
       public String getHeight();
      {
      
      
      } 
   }

Open in new window

0
Slck_P
Asked:
Slck_P
1 Solution
 
objectsCommented:
public int compareTo(Rider1 o) {
        return getScore() - o.getScore();
}
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now