Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

computer science CMSC 2 1 5 6 3 8 2 Inte; Project 4 . pdf Grammally - Gr . . . Grammarly 1 3 7

computer science
CMSC 2156382 Inte;
Project 4.pdf
Grammally - Gr...
Grammarly
13
78%
CMSC 215 Intermediate Programming Programming Project 4
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 Intervar defined for any type that implements the comparabie 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 Incerval object
A method vithin that is supplied an object of the generic type parameter and retums whether that object is inside the interval, including the endpoints
A method eubintervoI that is passed un imeevalias a parameter and returns whether the interval parameter is a subinterval, completely within, the interval on which the method is invoked
A method ovm etaps that is pasied hat intmal as parameter and returns whether the interval parameter overlaps the finte tos. Which the method is invoked minutes and one additional variablo for 1.. PM. PM. The class should implement the comparable interfice and should bc withods. At a minimum, it should contain the followily pubici inetiods:
A constructor that accepts the hours and minutes as integers and the meridian as a string and constructs a reme object
A constructor that accepts a string representation of a time in the format HH:MM AM and constructs a 2 Ine objoct
A method compare To that compares two times and retums what is required of all such methods that implement the comparebie interface
A method tostring that returns the string representation of the time in the format HH:MM AM
When either constructor is called, several checks need to be made on the input. For both constructors, a check is needed to ensure that the hours and minutes are within range and that the meridian is AM or PM. For the constructor that accepts the string representation, additional checks are needed to ensure that the hours and minutes are numeric values. Should any check fail, an exception Invalidziefe should be thrown that includes the reason.
The third class is the exception class Inveld intine that implements a checked exception. It should have an instance variable of type string that sives the message and the following method:
A constructor that accepts the message as a string and constructs an Invalidaime object
DCLLGiven a string s, find the length of the longest substring without repeating characters.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions