// time.cc  P. Conrad for CISC220, 06J

#include "time.h"

Time_C::Time_C (int theHour, int theMinute) 
{ 
  if (theHour > 23 || 
      theHour < 0 || 
      theMinute > 59 ||
      theMinute < 0 )
    {
      hour = minute = -1;
    }
  else
    {
      hour = theHour; minute = theMinute;
    }
}

void Time_C::print(std::ostream &out) const
{
  if (badTime())
    out << "xx:xx";
  else
    out << hour << ":" << minute;
}


std::ostream & operator << (std::ostream & right, 
			    const Time_C &left)
{
  left.print(right);
  return right;
}

