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

Write a c++ program that accepts a user-entered date. Have the program calculate

ID: 3637647 • Letter: W

Question

Write a c++ program that accepts a user-entered date. Have the program calculate and display the date of the next day. For this exercise, assume all months consists of 30 days.

Explanation / Answer

#include #define TRUE 1 #define FALSE 0 using namespace std; class mydate{ int day; int month; int year; public: void readdate(); string month2string(); int exceedsDaysInMonth(); void tommorow(); }; // Input date from user void mydate::readdate(){ cout > day; cout > month; cout > year; } // make sure month days are correct // return TRUE if days exceeds in a month int mydate::exceedsDaysInMonth(){ if ( month < 1 || month > 12 || day > 30) return TRUE; else return FALSE; } // convert numeric month into string string mydate::month2string(){ char *months[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; if ( exceedsDaysInMonth() ) { if ( ! (month < 1 || month > 12) ) return months[month-1]; else return "Unknown month"; } else return "Unknown month"; } // validate and calculate tommorows date void mydate::tommorow(){ int td, tm, ty; int days=30; if ( year < 0 ){ cerr
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