/* * compareTo is based on the compareTo method you used * in assignment 5 to compare Strings. * This compareTo compares two double values. * It returns 0 if the values are equal. * It returns -1 if the value of the first parameter * is less than the value of the second parameter. * It returns 1 if the value of the second parameter * is less than the value of the first parameter. */ public int compareTo (double oneValue, double otherValue) { if (Math.abs(oneValue - otherValue) < 0.0001) return 0; else if (oneValue < otherValue) return -1; else return 1; }