daily pastebin goal
96%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Comparator;
  2.  
  3. public class GeometricObjectAreaComparator
  4.     implements Comparator<GeometricObject>
  5. {
  6.   // Return 1 of o1 area > o2 area
  7.   // Return -1 of o1 area < o2 area
  8.   // Return 0 of o1 area == o2 area
  9.   public int compare(GeometricObject o1, GeometricObject o2)
  10.   {
  11.     // fill in your code
  12.     if (o1.getArea() > o2.getArea())
  13.     {
  14.         return 1;
  15.     }
  16.     else if (o1.getArea() < o2.getArea())
  17.     {
  18.         return -1;
  19.     }
  20.     else
  21.     {  
  22.         return 0;
  23.     }
  24.   }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top