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

Start with Chrono.h and Chrono.cpp in section 9.8; for now put a dummy \"return

ID: 3551684 • Letter: S

Question

  Start with Chrono.h and Chrono.cpp in section 9.8; for now put a dummy "return sunday;" or "return d;" in the last 3 functions on  page 332.  Add a prefix ++ operator to the Date class by putting the  declaration in the Date class in Chrono.h and the definition in Chrono.cpp.  The prefix ++ operator should change a date to "tomorrow" using the following pseudocode:    Date& operator++(){                 //add 1 to d  //tomorrow, unless we were at the end of the month                 //if is_date is false                 //            //need to change to first of next month                 //  set d to 1                 //  if m is December                 //            //need to change to next year too                       //    set m to January                 //    increment y                 //  else                 //    increment m                 return *this;   }          Write a main in hw5pr3.cpp which repeatedly reads a Date with cin >>, increments the Date with your ++, and prints "Tomorrow is" and the new value of the Date using cout <<. 

Explanation / Answer

Date& Date::operator++(){ if (is_date==false){ m=m+1; d=1; } if (m==dec && d==29){ m=jan; y=y+1; } else{ m=m+1; } d = d+1; }

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