Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ 265615/aignment/24348904 ignments > date date Date Implement a new struct-based data type Date in a header file date, including operator overloading for input,

in c++
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
265615/aignment/24348904 ignments > date date Date Implement a new struct-based data type Date in a header file date, including operator overloading for input, output and comparative operators. Write a function et Tomorrow that accepts a Date and returns a Date representing the next day. You will overload the '+'operator to accept a Date Dand an integer N, returning a date that is N days after D. You will also overload the comparative operators > ) to compare two Dates; for this situation, we will say that an earlier Date is less than" a later Date. Use the following definion for your Date struct: struct Dates You can test each of these functions separately by creating a source file ( eg, test.cpp) that creates a Date or two and calls functions to see what happens. Remember to include "date.h" in your source file. Be sure that you place the header file in the same directory as the source, and you should then be able to compile and execute this program, utilizing the type and functions defined in the leader file You can also use this source file with any suitable edits for testing neudete Dutes Previous & ' . O . . pause c/v BNM.P. ?, 1 > Assignments > date date Implement a new struct-based data type - Date - in a header file date., including operator overloading for input, output and comparative operators. Write a function get Tomorrow that accepts a Date and returns a Date representing the next day. You will overload the operator to accept a Date Dand an integer N returning a date that is N days after D. You will also overload the comparative operators >=, == } to compare two Dates; for this situation, we will say that an earlier Date is "less than a later Date. Use the following defintion for your Date struct: struct Date int day tions You can test each of these functions separately by creating a source file (e.g., test.cpp) that creates a Date or two and calls functions to see what happens. Remember to include "date.h" in your source file. Be sure that you place the header file in the same directory as the source, and you should then be able to compile and execute this program, utilizing the type and functions defined in the header file. You can also use this source file with any suitable edits for testing. Binclude #include "date. using namespace std; int main() Date XY ": cout > Next Previous Search date Date x,y: cout > ; ; cout > Y if( xcy) cout date date Here are some sample runs of the program. Enter x 10/23/3933 Enter YES 16 2009 10/29/1980 is earlier. A week after 10/29/1980 would be 11/5/1980 The day after 5/14/2009 would be 5/15/2009 Ten days! 5/14/2009 5/15/2009 5/16/2009 5/17/2009 5/18/2009 5/19/2009 5/20/2009 5/21/2009 5/22/2009 5/23/2009 You will have to consider things like the end of year and the varying length of February. Note that February has 28 days, except in leap years, when it has 29 days. Leap years occur when the year is divisible by 4 but not 100 (unless it is also divisible by 400). For example: 1992 was a leap year and 2000 was a leap year, but 1900 was not a leap year. Enter x: 12/25/2016 Enter y: 2/25/2016 2/25/2016 is earlier. A week after 12/25/2016 Muld be 1/1/2017 The day after 2/25/2016 would be 2/26/2016 Ten days: 215/2016 Next Previous 10:16 AM QADA 40 /10/2020 hp g ents > date date You will have to consider things like the end of year and the varying length of February. Note that February has 28 days. except in leap years, when it has 29 days. Leap years occur when the year is divisible by 4 but not 100 (unless it is also divisible by 400). For example: 1992 was a leap year and 2000 was a leap year, but 1900 was not a leap year. Enter x: 12/25/2016 Enter y: 2/25/2016 2/25/2016 is earlier. A week after 12/25/2016 would be 1/1/2017 The day after 2/25/2016 would be 2/26/2016 Ten days: 2/25/2016 2/26/2016 2/27/2016 2/28/2016 2/29/2016 3/1/2016 3/2/2016 3/3/2016 3/4/2016 3/5/2016 Submit Header file: Choose File No file chosen Submit View problem in a new window Next Previous 10:16 AM 304 48 2/10/2020

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

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

ISBN: 1292107634, 978-1292107639

More Books

Students also viewed these Databases questions