CST 206 Programming Problem 4 pg. 579

Design, implement, and test a class that represents an amount of time in minutes and seconds. The class should provide a constructor that sets the time to a specified number of minutes and seconds(1). The default constructor should create an object for a time of zero minutes and zero seconds(2). The class should provide observers that return the minutes and seconds separately(3), and an observer that returns the total time in seconds(4). Boolean comparison observers should be used that tell whether two times are equal(5), one is greater than the other(6), or one is lesser than the other(7). Transformers should be provided that add one time to another(8) or subtract one time from another(9). The class should not allow negative time (subtraction of more time than is currently stored should result in a time of 0:00)(10).

here's my pseudocode

Code:

#include <iostream>
using namespace std;
class Time
{
int mins, secs
public:
Time();
Time( int, int, int, int);
};
(1)Time::Time(){
mins=0;
secs=0;
};
(2)Time::Time(int mins, int secs) {
Time1(11, 30)
Time2(12, 14)
Time3(22, 54)
Time4(23, 19)
};
int Return() const // (3??)
//observer that returns the minutes and seconds seperately
Retun min;
Return Secs;
int Total() const //(4)
//observer that retuens the total time as seconds
Get total time
Return total time as seconds
bool Time::Equal( /* in */ Time otherTime ) const (5)
// Postcondition:
// Function value == true, if this time equals otherTime
// == false, otherwise
{
return (hrs == otherTime.hrs && mins == otherTime.mins &&
secs == otherTime.secs);
}
//******************************************************************
bool Time::LessThan( /* in */ Time otherTime ) const (6)
// Precondition:
// This time and otherTime represent times in the
// same day
// Postcondition:
// Function value == true, if this time is earlier
// in the day than otherTime
// == false, otherwise
{
return (hrs < otherTime.hrs ||
hrs == otherTime.hrs && mins < otherTime.mins ||
hrs == otherTime.hrs && mins == otherTime.mins
&& secs < otherTime.secs);
}
void Add Time() (7)
Add the times together
void Subtract() (8)
Subtract two times

I believe I have covered all the requirments. Two constructors, two observers, and two transformers??