Problem

Add the following member function to the ADT class Digital Time defined in Displays 12.1 a...

Add the following member function to the ADT class Digital Time defined in Displays 12.1 and 12.2:

void DigitalTime::interval_since(const DigitalTime& a_previous_time, int& hours_in_interval, int& minutes_in_interval) const

This function computes the time interval between two values of type DigitalTime. One of the values of type DigitalTime is the object that calls the member function i nterval_si nee, and the other value of type DigitalTime is given as the first argument. For example, consider the following code:

DigitalTime current(5, 45), previous(2, 30);

int hours, minutes;

current.interval_since(previous, hours, minutes);

cout « “The time interval between “ « previous

« “ and “ « current « endl « “is “ « hours « “ hours and

 “ « minutes « “ minutes.\n”;

In a program that uses your revised version of the DigitalTime ADT, this code should produce the following output:

The time interval between 2:30 and 5:45 is 3 hours and 15 minutes.

Allow the time given by the first argument to be later in the day than die time of the calling object. In this case, the time given as the first argument is assumed to be on the previous day. You should also write a program to test this revised ADT class

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 12
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT