Question: In java Exercise 5.6. Write a class IntervalIncludeChecker with static method containsPoint which Takes three double values x1, x2, and z The first two parameters

In java

In java Exercise 5.6. Write a class IntervalIncludeChecker with static method containsPoint

Exercise 5.6. Write a class IntervalIncludeChecker with static method containsPoint which Takes three double values x1, x2, and z The first two parameters x1 and x2 correspond to the start- and endpoints of one interval. We can assume that x1 will be less than or equal to x2 The last parameter z is interpreted as a point on the same axis where the interval [x1, x2] lies. Returns an integer value to describe the position of z relative to the interval [x1,x21: The result should be negative if z is less than x1, that is, if the point lies to the left of the interval. - The result should be positive if z is greater than x2, that is, if the point lies to the right of the interval. The result should be zero if z is both greater than or equal to x1 and less than or equal to x2, that is, if the point in the interval. In both this and the next exercise, assume that the interval is closed, that is, that the endpoints are included in the interval. So for example IntervalIncludeChecker.containsPoint (0.0, 2.0, 9.0) should return some positive number. IntervalIncludeChecker.containsPoint (0.0, 2.0, 1.0) IntervalIncludeChecker.containsPoint (0.0, 2.0, 2.0) should both return zero. and IntervalIncludeChecker.containsPoint (o.0, 1.0,-1.0) should return some negative number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!