A6-CS102 - cout<< The time interval...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS102 Assignment 6 Question : Add the following member function to the ADT class DigitalTime defined in Display 12.1 and 12.2: Void DigitalTime::interval_since(const DigitalTime& a_previous_time, int& 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 interval_since , And 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);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout<< The time interval between << previous<< and current<<endl << is << hours<< hours and <<minutes<< minutes. \n; In the program that uses your revised version of the DigitalTime ADT, this code should produce the following output Allow the time given by the first argument to be later in the day then the 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. The time interval between 2:30 and 5:45 is 3 hours and 15 minutes...
View Full Document

Ask a homework question - tutors are online