#ifndef CLOCK_h_included #define CLOCK_h_included #include class Clock { public: Clock(String name):clockSpeed_modelMsPerRealSec(1000), clockName(name) {}; Clock(String name, unsigned int h, unsigned int m):hours(h), minutes(m), clockSpeed_modelMsPerRealSec(1000), clockName(name) {}; Clock(String name, unsigned int h, unsigned int m, unsigned int s):hours(h), minutes(m), seconds(s), clockSpeed_modelMsPerRealSec(1000), clockName(name) {}; void addSeconds(unsigned int n) { seconds++; if (seconds >= 60) { addMinutes(1); seconds -= 60; }}; void addMinutes(unsigned int n) { minutes++; seconds -= 60; if (minutes >= 60) { addHours(1); minutes -= 60; }}; void addHours(unsigned int n) { hours++; if (hours >= 24) { hours -= 24; }}; void setTime(unsigned int h, unsigned int m) { hours=h; minutes=m; }; void setTime(unsigned int h, unsigned int m, unsigned int s) { hours=h; minutes=m; seconds=s; }; unsigned int getHours() { return hours; }; unsigned int getMinutes() { return minutes; }; unsigned int getSeconds() { return seconds; }; void setSpeed_modelMsPerRealSecond(unsigned int speed) { clockSpeed_modelMsPerRealSec = speed; }; unsigned int getSpeed_modelMsPerRealSecond() { return clockSpeed_modelMsPerRealSec; }; void setClockName(char *name) { clockName = String(name); }; void setClockName(String name) { clockName = name; }; String getClockName() { return clockName; }; protected: unsigned int hours, minutes, seconds; unsigned int clockSpeed_modelMsPerRealSec; String clockName; }; #endif