++. 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. Can you please provide every section of code that is needed there is Time.cpp, Time.h, Date.cpp, Date.h, Event.cpp, Event.h, and main.cpp. Thank you!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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. Can you please provide every section of code that is needed there is Time.cpp, Time.h, Date.cpp, Date.h, Event.cpp, Event.h, and main.cpp. 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; }

int Time::timeToSeconds() const
{
    return (getSecond() + getMinute() * 60 + getHour() * 3600);
}

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;
};

#endif

------

Event.cpp

------

Event.h

------

main.cpp

#include <iostream>
#include "Time.h"
#include "Date.h"
#include "Event.h"
using namespace std;

int main() {
   return 0;
}

You are going to be creating part of an event planning system. You will create three classes: Time, Date, Event. Together these classes will
have the functionality to describe when events take place, and the ability to compare different times.
Time
This class is going to represent a 24-hour cycle clock time. That means 0:0:0 (Hour:Minute:Second) is the beginning of a day and 23:59:59
is the end of the day.
This class has these data members.
• int sec
• int min
• int hour
You will write the time class to have these functions.
Default Constructor
The default constructor will initialize the time object to its minimum value: 0:0:0.
Constructor
The time constructor will take in 3 integers, hours, minutes, seconds. If the constructor receives invalid numbers, like 63 minutes or -1
hours, then it will set that value to ZERO. Note: The constructor should actually throw an error instead, but that topic is not covered until the
end of the semester.
The accepted ranges
member variables:
seconds: o -> 59
minutes: 0 -> 59
hours:
O -> 23
Getters and Setters
You should create a getter and setter method for each member variable. For this assignment we provide these. Note: The getter methods
should be constant and their parameter should be a constant reference.
toString
This function will return a string describing what time the object represents. The format is hour:minute:second.
Time time = Time (17, 59, 1);
cout << time.toString () << endl;
The above code should return:
17:59:01
timeToSeconds
This is a Private helper function and will make the +, -, < ,and > functions easier. This function should take no input and return and integer
value of time in seconds. A time represented by 0:3:21 would result in 201 being returned. This function is provided in the template.
int timeToSeconds ()
const;
secondsToTime
This is a Private helper function and will make the +, -, < ,and > functions easier. This function should take an integer as input and return a
Time object. This function is provided in the template.
const Time secondsToTime (int s) const;
+ and - operators
The time class will support the addition and subtraction of two "Time" objects. The standard rollovers apply i.e. instead of having 63
seconds its 3 seconds into the next minute. If the resulting Time is past 23 hours then you roll hours to 0.
const Time operator+ (const &Time other)
const;
const Time operator- (const &Time other) const;
> and < operators
The Time class will support the greater than and less than operators. 0:0:0 is the smallest time and 23:59:59 is the greatest time.
bool operator< (const & Time other) const;
== operator
Two time objects are equal when they have the same values for their member variables.
bool operator== (const& Time other) const;
Date
This class will represent a calendar day. For simplicity, we are excluding leap years, and all months have 31 days. Thus, a year for this
program has 372 days (31 days x 12).
This class has these data members.
• int month
int day
• int year
You will write the date class to have these functions.
Default Constructor
The default constructor will initialize the date object to its minimum value: 1/1/0.
Constructor
The Date constructor will take 3 integer parameters, day, month, year. If the constructor receives invalid parameters, such as 15 for month,
it will set that value to ZERO.
The accepted ranges of the member variables:
day: 1 -> 31
month: 1 -> 12
year:
O -> inf
Getters and Setters
You should create a getter and setter method for each member variable. For this assignment we provide these. Note: The getter methods
should be constant and their parameter should be a constant reference.
toString
This function will return a string describing what date the object represents. The format is dd/mm/yyyy.
Date date = Date (5, 2, 1999);
cout << date.toString () << endl;
The above code should print:
5/2/1999
dateToDays
This is a Private helper function and will make the +, - < and > functions easier. This function takes no input and returns the number of days
from the minimum Date. So a date 3/1/1 would return 1119. This function is Not provided in the template.
int dateToDays () const;
daysToDate
This is a Private helper function and will make the +, -, < ,and > functions easier. This function takes aan integer as input and returns a Date.
This is the reverse calculation of dateToDays. This function is Not provided in the template.
const Date daysToDate (int ndays) const;
+ and - overload (Date + int)
Sometimes it doesn't make sense to add two of the same object together, but rather two different objects. Adding two Time objects
together makes more sense than adding two date objects together. People don't use dates that way. Specifically, we think of elapsed dates
as the number of days elapsed. So for this class, we are only going to add (or subtract) an integer to a Date, which represents the number
of days ahead or behind the date.
const Date operator+ (int other) const;
const Date operator- (int other)
const;
Date date1 = Date (5, 2, 2021) ;
datel = datel + 7;
cout << datel.toString () << endl;
The above code should print:
12/2/2021
> and < overload
The Date class will support the greater than and less than operators. 1/1/0 is the smallest date and 31/12/inf is the greatest date.
bool operator< (const & Date other) const;
bool operator> (const & Date other) const;
== overload
Two date objects are equal when they have the same values for their member variables.
bool operator== (consté Date other) const;
Event
This class has these data members.
pgramming Assignment 5- Classes
• Date date
• Time time
You will write the event class to have these functions. This class should have as members one Date and one Time object.
Constructor
The event constructor will take two strings, a date, and a time as input. The first is the description, the second is the location, third is date,
fourth is time.
hasPassed
This function will return True if the event has passed. It will take a date and a time as input.
Date today = Date (10, 20, 2021);
Event event = Event ("Party", "Cari's House", today, Time (22, 0, 0));
cout << event.hasPassed (today, Time (22, 10, 0)) « endl;
Transcribed Image Text:You are going to be creating part of an event planning system. You will create three classes: Time, Date, Event. Together these classes will have the functionality to describe when events take place, and the ability to compare different times. Time This class is going to represent a 24-hour cycle clock time. That means 0:0:0 (Hour:Minute:Second) is the beginning of a day and 23:59:59 is the end of the day. This class has these data members. • int sec • int min • int hour You will write the time class to have these functions. Default Constructor The default constructor will initialize the time object to its minimum value: 0:0:0. Constructor The time constructor will take in 3 integers, hours, minutes, seconds. If the constructor receives invalid numbers, like 63 minutes or -1 hours, then it will set that value to ZERO. Note: The constructor should actually throw an error instead, but that topic is not covered until the end of the semester. The accepted ranges member variables: seconds: o -> 59 minutes: 0 -> 59 hours: O -> 23 Getters and Setters You should create a getter and setter method for each member variable. For this assignment we provide these. Note: The getter methods should be constant and their parameter should be a constant reference. toString This function will return a string describing what time the object represents. The format is hour:minute:second. Time time = Time (17, 59, 1); cout << time.toString () << endl; The above code should return: 17:59:01 timeToSeconds This is a Private helper function and will make the +, -, < ,and > functions easier. This function should take no input and return and integer value of time in seconds. A time represented by 0:3:21 would result in 201 being returned. This function is provided in the template. int timeToSeconds () const; secondsToTime This is a Private helper function and will make the +, -, < ,and > functions easier. This function should take an integer as input and return a Time object. This function is provided in the template. const Time secondsToTime (int s) const; + and - operators The time class will support the addition and subtraction of two "Time" objects. The standard rollovers apply i.e. instead of having 63 seconds its 3 seconds into the next minute. If the resulting Time is past 23 hours then you roll hours to 0. const Time operator+ (const &Time other) const; const Time operator- (const &Time other) const; > and < operators The Time class will support the greater than and less than operators. 0:0:0 is the smallest time and 23:59:59 is the greatest time. bool operator< (const & Time other) const; == operator Two time objects are equal when they have the same values for their member variables. bool operator== (const& Time other) const; Date This class will represent a calendar day. For simplicity, we are excluding leap years, and all months have 31 days. Thus, a year for this program has 372 days (31 days x 12). This class has these data members. • int month int day • int year You will write the date class to have these functions. Default Constructor The default constructor will initialize the date object to its minimum value: 1/1/0. Constructor The Date constructor will take 3 integer parameters, day, month, year. If the constructor receives invalid parameters, such as 15 for month, it will set that value to ZERO. The accepted ranges of the member variables: day: 1 -> 31 month: 1 -> 12 year: O -> inf Getters and Setters You should create a getter and setter method for each member variable. For this assignment we provide these. Note: The getter methods should be constant and their parameter should be a constant reference. toString This function will return a string describing what date the object represents. The format is dd/mm/yyyy. Date date = Date (5, 2, 1999); cout << date.toString () << endl; The above code should print: 5/2/1999 dateToDays This is a Private helper function and will make the +, - < and > functions easier. This function takes no input and returns the number of days from the minimum Date. So a date 3/1/1 would return 1119. This function is Not provided in the template. int dateToDays () const; daysToDate This is a Private helper function and will make the +, -, < ,and > functions easier. This function takes aan integer as input and returns a Date. This is the reverse calculation of dateToDays. This function is Not provided in the template. const Date daysToDate (int ndays) const; + and - overload (Date + int) Sometimes it doesn't make sense to add two of the same object together, but rather two different objects. Adding two Time objects together makes more sense than adding two date objects together. People don't use dates that way. Specifically, we think of elapsed dates as the number of days elapsed. So for this class, we are only going to add (or subtract) an integer to a Date, which represents the number of days ahead or behind the date. const Date operator+ (int other) const; const Date operator- (int other) const; Date date1 = Date (5, 2, 2021) ; datel = datel + 7; cout << datel.toString () << endl; The above code should print: 12/2/2021 > and < overload The Date class will support the greater than and less than operators. 1/1/0 is the smallest date and 31/12/inf is the greatest date. bool operator< (const & Date other) const; bool operator> (const & Date other) const; == overload Two date objects are equal when they have the same values for their member variables. bool operator== (consté Date other) const; Event This class has these data members. pgramming Assignment 5- Classes • Date date • Time time You will write the event class to have these functions. This class should have as members one Date and one Time object. Constructor The event constructor will take two strings, a date, and a time as input. The first is the description, the second is the location, third is date, fourth is time. hasPassed This function will return True if the event has passed. It will take a date and a time as input. Date today = Date (10, 20, 2021); Event event = Event ("Party", "Cari's House", today, Time (22, 0, 0)); cout << event.hasPassed (today, Time (22, 10, 0)) « endl;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Processes of 3D Graphics
Learn more about
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education