基本上,我需要创建一个名为:
public boolean doesContain(double x)
像这样工作:
Returns true if and only if x lies between left and right, and the
interval is not empty (i.e. left < right).
这就是类的样子:
public class Interval {
private double left;
private double right;
public Interval(double left, double right){
this.left = left;
this.right = right;
}
public boolean doesContain(double x){
ArrayList<Double> nums = new ArrayList<Double>();
//Add code here
}
}