prog4 - Programming assignment #4 due 2/4 Design a class to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming assignment #4 due 2/4 Design a class to represent a time Period . A time Period represents an integer number of hours and minutes, and a floating-point number of seconds. New Period objects are initialized to zero by default. A Period object may also be initialized with a given number of hours; hours and minutes;or hours, minutes, and seconds. For example, the following are valid Period object declarations and initializations; Period a, b; // default to 0:0:0.0 Period c(1), d(2, 3), e(4,5, 6.7) // 1:0:0.0, 2:3:0.0, and 4:5:6.7 time periods. Period objects may be added or subtracted; b = a - c + d - e; Period objects may be multiplied or divided by integer or float values; a = (b * 2) + (3 * c) / 4.5; Period objects may be input and output using >> and << operators. A Period object is always input and output as a colon separated sequence of hours, minutes, and seconds. Minutes are always in the range 0. .59 and seconds are always in the range 0. .59.9999; cout << “Input a time period”;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/03/2010 for the course CS 1410 taught by Professor Staff during the Spring '08 term at Utah State University.

Page1 / 2

prog4 - Programming assignment #4 due 2/4 Design a class to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online