C++. Please do not change the existing code. The instructions are in the image that is provided. Please zoom in or you can download the png file. Thank you! Time.cpp
C++. Please do not change the existing code. The instructions are in the image that is provided. Please zoom in or you can download the png file. Thank you! Time.cpp
C++. Please do not change the existing code. The instructions are in the image that is provided. Please zoom in or you can download the png file. Thank you! Time.cpp
C++. Please do not change the existing code. The instructions are in the image that is provided. Please zoom in or you can download the png file. Thank you!
Time.cpp
#include "Time.h"
//Default Constructor
//Constructor with parameters
int Time::getHour() const { return hour; } int Time::getMinute() const { return minute; } int Time::getSecond() const { return second; } void Time::setHour(int h) { hour = h; } void Time::setMinute(int m) { minute = m; } void Time::setSecond(int s) { second = s; }
const Time Time::secondsToTime(int s) const { int resultS = s % 60; s /= 60; int resultM = s % 60; s /= 60; int resultH = s % 24; return Time(resultH, resultM, resultS); }
//toString
// +
// -
// <
// >
// ==
------
Time.h
#ifndef TIME #define TIME
#include <string>
using namespace std;
class Time { private: int hour; int minute; int second; int timeToSeconds() const; const Time secondsToTime(int s) const;
public: Time(); Time(int h, int m, int s); string toString() const; int getHour() const; void setHour(int h); int getMinute() const; void setMinute(int m); int getSecond() const; void setSecond(int s); const Time operator+(const Time &other) const; const Time operator-(const Time &other) const; bool operator<(const Time &other) const; bool operator>(const Time &other) const; bool operator==(const Time &other) const; };
#endif
------
Date.cpp
#include "Date.h"
//Default Constructor
//Constructor with parameters
int Date::getDay() const { return day; } int Date::getMonth() const { return month; } int Date::getYear() const { return year; } void Date::setDay(int h) { day = h; } void Date::setMonth(int m) { month = m; } void Date::setYear(int s) { year = s; }
//dateToDays
//daysToDate
//toString
// +
// -
// <
// >
// ==
------
Date.h
#ifndef DATE #define DATE
#include <string>
using namespace std;
class Date { private: int day; int month; int year; int dateToDays() const; const Date daysToDate(int ndays) const;
public: Date(); Date(int d, int m, int y); string toString() const; int getDay() const; void setDay(int d); int getMonth() const; void setMonth(int m); int getYear() const; void setYear(int y); const Date operator+(int ndays) const; const Date operator-(int ndays) const; bool operator<(const Date &other) const; bool operator>(const Date &other) const; bool operator==(const Date &other) const; };
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.