Modify the LabeledPoint class of Reimplement the so that it implements the Comparable interface. Sort points first by their x-coordinates. If two points have the same x-coordinate, sort them by their y-coordinates. If two points have the same x- and y-coordinates, sort them by their label. Write a tester program that checks all cases.

Complete the following file:

LabeledPoint.java

Use the following file:

LabeledPointTester.java

/**
   A tester class to compare LabeledPoint class implementation.
*/
public class LabeledPointTester
{

   public static void compare(LabeledPoint a, LabeledPoint b, String expected)
   {
      int value = a.compareTo(b);
      String actual;
      if (value < 0) actual = "<";
      else if (value == 0) actual = "==";
      else actual = ">";      
      System.out.println(a + actual + b);
      System.out.println("Expected: " + a + expected + b);
   }
   
   public static void main(String[] args)
   {
      LabeledPoint p1 = new LabeledPoint(10, 45, "Fred");
      LabeledPoint p2 = new LabeledPoint(45, 10, "Amy");
      LabeledPoint p3 = new LabeledPoint(10, 45, "Beth");
      LabeledPoint p4 = new LabeledPoint(10, 33, "Carolyn");
      LabeledPoint p5 = new LabeledPoint(11, 55, "Fred");
      LabeledPoint p6 = new LabeledPoint(11, 55, "Fred");

      /* test x-coordinates different */
      compare(p1, p2, "<");
      compare(p2, p1, ">");

      /* tests x-coordinates identifical, y-coordinates different */
      compare(p2, p4, ">");
      compare(p4, p2, "<");

      /* tests x- and y-coordinates identifical, labels different */
      compare(p1, p3, ">");
      compare(p3, p1, "<");

      compare(p6, p6, "==");
      compare(p4, p4, "==");
   }
}