Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following interface for an ADT for representing intervals (periods of time as opposed to instantaneous moments of time). typedef long Duration; // measured

Consider the following interface for an ADT for representing intervals (periods of time as opposed to instantaneous moments of time).

typedef long Duration; // measured in seconds class DateTime { public: DateTime (int year, int month, int day, int hour, int minute, int second); 
 ... // How many seconds between two times? Duration operator- (const DateTime& right) const; }; class Interval { public: // // An interval is a period of time beginning with a starting time // and running up to, but not including, its stop time. // Interval (); Interval (DateTime start, DateTime stop); Interval (DateTime start, Duration length); DateTime getStart() const; void setStart (DateTime); DateTime getStop() const; void setStop (DateTime); Duration getDuration(); bool contains (DateTime d); bool overlaps (Interval intrvl); bool operator== (const Interval& other) const; 
private: DateTime theStart, theStop; }; 

Using the JUnit style, write a self-checking test for the 3rd Interval constuctor.

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Question Can a self-employed person adopt a profit sharing plan?

Answered: 1 week ago