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

Write a program that inputs a date (e.g., July 4, 2010)and outputs the day of th

ID: 3617552 • Letter: W

Question

Write a program that inputs a date (e.g., July 4, 2010)and outputs the day of the week that corresponds to thatdate.

bool isLeapYear(int year);

This function should return true if year is a leap yearand false if it is not.

pseudocode to determine leap year:

            Leap_year = ((year divisible by 400) or (year divisible by 4 andyear not divisible by 100))

int getCenturyValue(int year);

This function should take the first two digits of the year(i.e., the century), divide by 4, and save the remainder. Subtract the remainder from 3 and return this value multiplied by2.

int getYearValue(int year);

This function computes a value based on the years since thebeginning of the century. First, extract the last two digitsof the year. Next, factor in leap years. Divide thevalue from the previous step by 4 and discard the remainder. Add the two results together and return this value.

int getMonthValue(int month, int year );

This function should return a value and will require invokingthe isLeapYear function.

Finally, to compute the day of the week, compute the sum of thedate’s day plus the values returned by: getMonthValue,getYearValue, and getCenturyValue. Divide the sum by 7 andcompute the remainder. A remainder of 0 corresponds toSunday, 1 corresponds to Monday, etc., up to 6 which corresponds toSaturday.

Your program should allow the user to enter any date and outputthe corresponding day in English.

This program should include a void function named getInput thatprompts the user for the date and returns the month, day, and yearusing pass-by-reference parameters. You may choose to havethe user enter the date’s month as either a number (1-12) ora month name.

Explanation / Answer

please rate - thanks #include using namespace std; void getInput(int &, int &, int &); bool isLeapYear(int); int getCenturyValue(int); int getYearValue(int); int getMonthValue(int, int); int main() { int month,mth,yr,cen,day, year,dow;    string name;     getInput(month,day,year);     mth=getMonthValue(month, year);     yr=getYearValue(year);     cen=getCenturyValue(year);     dow=(day+mth+yr+cen)%7;     switch(dow)        {case 0: name="Sunday";break;        case 1: name="Monday";break;        case 2: name="Tuesday";break;        case 3: name="Wednesday";break;        case 4: name="Thursday";break;        case 5: name="Friday";break;        case 6: name="Saturday";break;       }                 cout
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