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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post by answerhappygod »

Consider The Following Interface For An Adt For Representing Intervals Periods Of Time As Opposed To Instantaneous Mome 1
Consider The Following Interface For An Adt For Representing Intervals Periods Of Time As Opposed To Instantaneous Mome 1 (68.23 KiB) Viewed 49 times
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 setStop function.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply