Question: Write a data type Interval that implements the following API: An interval is defined to be the set of all points on the line greater
Write a data type Interval that implements the following API:

An interval is defined to be the set of all points on the line greater than or equal to min and less than or equal to max. In particular, an interval with max less than min is empty. Write a client that is a filter that takes a floating-point command-line argument \(x\) and prints all of the intervals on standard input (each defined by a pair of double values) that contain \(x\).
public class Interval Interval (double min, double max) boolean contains (double x) boolean intersects (Interval b) String toString() is x in this interval? do this interval and b intersect? string representation
Step by Step Solution
3.45 Rating (155 Votes )
There are 3 Steps involved in it
Certainly Lets start by creating the Interval class as specified in the API We will define methods t... View full answer
Get step-by-step solutions from verified subject matter experts
