Question: The fourth programming project involves writing a program to test the relationships between time intervals. The program should contain four classes. The first class should

The fourth programming project involves writing a program to test the relationships between
time intervals. The program should contain four classes. The first class should be a generic class
Interval defined for any type that implements the Comparable interface. Objects of this type
have a start and end of the generic type parameter that defines the start and end of the interval.
The class should be immutable, so it should have no setter methods. At a minimum, it should
contain the following public methods:
A constructor that accepts the start and end of an interval and constructs an Interval
object
A method within that is supplied an object of the generic type parameter and returns
whether that object is inside the interval, including the endpoints
A method subinterval that is passed an interval as a parameter and returns whether the
interval parameter is a subinterval, completely within, the interval on which the method is
invoked
A method overlaps that is passed an interval as a parameter and returns whether the
interval parameter overlaps the interval on which the method is invoked
The second class Time should contain two integer instance variables that represent the hours and
minutes and one additional variable for the meridian, AM or PM. The class should implement
the Comparable interface and should be immutable, so it should have no setter methods. At a
minimum, it should contain the following public methods:

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!