FR 2015 #3

go back
    

Part A

public interface NumberGroup { boolean contains(int x); }

Part B

public class Range implements NumberGroup { private int minValue, maxValue; public Range(int min, int max) { minValue = min; maxValue = max; } public boolean contains (int x) { return x >= minValue && x <= maxValue; } }