Question: Write a C++ program that, given a person's birth date, display the day of the week the person was born, and whether the person is

 Write a C++ program that, given a person's birth date, display

the day of the week the person was born, and whether the

Write a C++ program that, given a person's birth date, display the day of the week the person was born, and whether the person is born in a leap year. For this assignment, we assume that all the data entered by the user is correct. For example, no negative value is entered, no month value of greater than 12 is entered, etc. Create a directory named "OLA6" under the "OLA" directory. Put all the files relate to this assignment. in the OLA6 directory. There is no startup template program to copy for this assignment. Name your program "weekday.cc" How to determine the day of the week one was born. We use the formula called the Zeller's Rule to compute the day of the week for a person's birthday. The following formula is named Zeller's Rule after the Reverend Zeller. Here's the formul es are declared as integer type all varial d is the day of the month. Let's use January 29, 2064 as an example. For this date, d -29 m is the month number. Months have to be counted in a special way for Zeller's Rule March is 1 April is 2, and so on to January is 11, and February is 12. (This makes the formula simpler, because on leap years February 29 is counted as the last day of the year.) Because of this rule, January and February are always counted as the 11th and 12th months of the previous year. In our example, m 1. (use if else if statement to compute the m value) if original birth month is January or February: subtract 1 from year value. In our case, birth month is January, therefore, year 2064 1 2063 Dis the last two digits of the modified year value. In this example, D 2063%100 63. C stands for century: it's the first two digits of the modified year value. In our case, C 2063/100 20 Now let's substitute our example numbers into the formula. f d (13 m-1) 51 D [D/4] [C/4] 2 C 29 (13.11-1)5] 63 163/4] [20/4 2 20 29 [28.4 63 [151 (51-40 29 28 63 15 5-40 100. This number modulo 7 is the day of week: (0:Sunday, Monday, 2:Tuesday, 3:Wednesday, 4: Thursday, 5 Friday, 6:Saturday). For example, 100%7-2. Therefore Jan 29th, 2064 is on Tuesday. If the remainder is negative, add 7 to the remainder. Use "if- else if-else" statement to display the day of the week. Thoroughly test your program before turning it in. To test whether your program produces the correct result, check your program's output against the calendar using the Unix command "cal". For example, to see the calendar of year 1980, type: cal 1980

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!