#include <iostream>
#include <iomanip>
#include "StopWatch.h"
StopWatch::StopWatch()
{
seconds_ = 0;
}
StopWatch::StopWatch(int seconds)
{
seconds_ = seconds;
}
StopWatch::StopWatch(int hour, int minutes, int seconds)
{
seconds_ = (hour * 3600) + (minutes * 60) + seconds;
}
void StopWatch::Increment(int seconds)
{
seconds_ += seconds;
}
void StopWatch::Reset()
{
seconds_ = 0;
}
void StopWatch::Display() const
{
int hours, minutes, seconds;
hours = seconds_ / 3600;
minutes = (seconds_ - (hours * 3600)) / 60;
seconds = seconds_ % 60;
std::cout.fill('0');
std::cout << std::setw(2) << hours << ':';
std::cout << std::setw(2) << minutes << ':';
std::cout << std::setw(2) << seconds << std::endl;
}
int StopWatch::GetSeconds() const
{
return seconds_;
}