Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please update the code below for the Date.cpp to output dates in this format: MM/DD/YYYY and not DD/MM/YYYY. Please, pay a closer attention

Could you please update the code below for the Date.cpp to output dates in this format: MM/DD/YYYY and not DD/MM/YYYY. Please, pay a closer attention to the output in the question below.

#include "stdafx.h"

#include

#include

#include

#include "Date.h"

using namespace std;

Date::Date()

{

month = 1;

day = 1;

year = 1970;

}

Date::Date(int m, int d, int y)

{

month = m;

day = d;

year = y;

}

void Date::setDate(int mm, int dd, int yyyy)

{

month = mm;

day = dd;

year = yyyy;

}

void Date::displayDate() const

{

cout

if (month

cout

cout

cout

}

bool Date::operator==(const Date& other) const

{

if (day == other.day && month == other.month && year == other.year)

return true;

else

return false;

}

bool Date::operator!=(const Date& other) const

{

if (day == other.day && month == other.month && year == other.year)

return false;

else

return true;

}

bool Date::operator

{

if (year

return true;

else if (year>other.year)

return false;

else

{

if (month

return true;

else if (month>other.month)

return false;

else

{

if (day

return true;

else

return false;

}

}

}

bool Date::operator>(const Date& other) const

{

if (year>other.year)

return true;

else if (year

return false;

else

{

if (month>other.month)

return true;

else if (month

return false;

else

{

if (day>other.day)

return true;

else

return false;

}

}

}

bool Date::operator

{

if (year

return true;

else if (year>other.year)

return false;

else

{

if (month

return true;

else if (month>other.month)

return false;

else

{

if (day

return true;

else

return false;

}

}

}

void Date::setDefaultDate()

{

month = 1;

day = 1;

year = 1970;

}

bool Date::operator>=(const Date& other) const

{

if (year>other.year)

return true;

else if (year

return false;

else

{

if (month>other.month)

return true;

else if (month

return false;

else

{

if (day >= other.day)

return true;

else

return false;

}

}

}

ostream &operator

{

output

if (d.month

output

output

output

return output;

}

istream &operator>>(istream &input, Date &d)

{

int mm, dd, yyyy;

input >> mm >> dd >> yyyy;

d.setDate(mm, dd, yyyy);

return input;

}

image text in transcribedimage text in transcribed image text in transcribedimage text in transcribed

Overloadedoperators-DateDriver #include "stdafx.h" #include #include #include "Date . h" using namespace std; void display(Date first, string op, Date second); int main() tring op, const Date& right); Date date01 (12, 31, 2015); Date date02(1, 1, 2016); Date date03 (2, 28, 2017) Date date04 (3, 1, 2017); Date date05(3, 2, 2017); Date date06(3, 3, 2017) Date date07 (10, 1, 2017); Date date08 (1, 31, 2018); Date date09; Date date10; date09 date01; date10- date02; cout ", date04): display (date06, ">", datees); cout ", date06); display (date01, -", date10); cout ", date06); display (date08, ">", date07); // difference in minutes (same hour) // difference in hours Page 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what is meant by higher cost of quality

Answered: 1 week ago

Question

=+Have they changed the way employees view IP?

Answered: 1 week ago