Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A date consists of a month, day, and year. Frequently, we represent each of thes

ID: 3584097 • Letter: A

Question

A date consists of a month, day, and year. Frequently, we represent each of these items as integers. For example, July 4, 1990, is a month 7, day 4, and year 1990.

a.Write specifications for a method that advances any given date by one day. Include a statement of purpose, pre- and post-conditions, and a description of the parameters.

b.Write a C++ implementation of this method. Design and specify any other methods that you need. Include comments that will be helpful to someone who will maintain your implementation in the future.

Explanation / Answer

void get_date( int * month, int * day, int * year ) { struct tm *current; time_t timenow; time(&timenow); current = localtime(&timenow); *month = current->tm_mon+1; *day = current->tm_mday; *year = current->tm_year+1900; return; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote