Question: solution? C++ Problem 2: Find the Day of the Week [20] Write a program that will calculate the day of the week for any date

Problem 2: Find the Day of the Week [20] Write a program that will calculate the day of the week for any date between September 4, 1752 and Dec 31, 2399. To find the day of the week you first must determine whether the year was a leap year. In general, if a year is evenly divisible by 4, it is a leap year. However, there are exceptions Century years, such as 1800 and 1900, are not leap years, despite the fact that they are divisible by 4. Furthermore, as an exception to the exception, a century year that is divisible by 400 (such as the year 2000) is a leap year. The algorithm for finding the day of the week requires several key numbers that can be obtained from the following tables. Month Key Jan 1 (0 if Leap Year) Feb 4 (3 if Leap Year) Mar 4 Apr May Jun 3 Month Jul Aug Sep Oct Nov Dec Key 0 13 6 Day Key Sat 0 Sun 1 Mon 2 Century Kev 17008 1800s 2 1900s 0 20005 6 21005 22005 2 23005 0 ola 4 6 Tue 3 Wed 4 Thr 5 Fri 6 The algorithm works as follows: (We will use December 7, 1941, as an example) Step 1: obtain the following 5 numbers 1) The last two digits of the year 41 2) The number from step 1 divided by 4 (ignore remainder) 10 3) The month key (find from the table) 4) The day of the month 5) The century key (find from the table) Step 2. add the five numbers 64 Step 3. divide the sum by 7 and keep the remainder 6479 TI Step 4: Find the remainder in the day key table to find the day of the week oro Sample Output: Enter the day 11 - 31): 7 Enter the month (1 - 12): 12 Enter the year (1752 - 2399) 1941 That day is Sunday. Required Test Cases 5, 10, 1957 20.2.1969 115 2000 15, 1.200 151 2004
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
