0

So we're supposed to modify this class, which implements Comparable, so that it accepts any type of object. The Comparable interface contains the method signature for compareTo, which I need to implement. What I'm uncertain of is how to implement this method. I know that compareTo is supposed to return -1, 0, or 1 but I'm not sure what goes inside the if statements (-1 if object1 < object 2, 0 if object 1 == object 2, and 1 if object1 > object2)

Also, assume that we can only have the instance variable minimum and maximum and that the rest of the methods cannot be changed.

```
/**
Computes the average of a set of data values.
Determines the largest of a set of data values.
*/
public class DataSet implements Comparable
{
/**
Constructs an empty data set.
*/
public DataSet()
{
maximum = null;
minimum = null;
}
/**
Adds a data value to the data set
@param x a data value
*/
public void add(Comparable x)
{
if (minimum == null || this.compareTo(x) < 0)
minimum = x;
if (maximum == null || this.compareTo(x) > 0)
maximum = x;
}
/**
Gets the largest of the added data.
@return the maximum or 0 if no data has been added
*/
public Comparable getMaximum()
{
return maximum;
}
public Comparable getMinimum()
{
return minimum;
}
public int compareTo(Object o)
{
if ()
return -1;
else if ()
return 0;
else
return 1;
}
private Comparable minimum;
private Comparable maximum;
}
```