Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSCI 2 1 7 0 OLA 1 Write a C + + program that, given a person's birth date, computes and displays the day of
CSCI OLA
Write a C program that, given a person's birth date, computes and displays the day of the week the person was born. The description of the assignment is given below.
Check for User inputs
Your program should first check for user inputs. If the date entered is not a valid, send out an error message as shown in the example below:
Incorrect Data
If the date entered is valid, proceed to compute for the corresporiding week of the day.
Determine the day of the week one was born
We use the formula called: Zeller's Rule to compute the day of the week for a person's birthday. The following formula is named Zeller's Rule after a Reverend Zeller. Here's the formula:
larr declare all variables to be of integer type
d is the day of the month. Let's use January as an example. For this date,
is the month number. Months have to be counted in a special way for Zeller's Rule: March is April is and so on to January is and February is This makes the formula simpler, because on leap years February is counted as the last day of the year. Because of this rule, January and February are always counted as the th and th months of the previous year. In our example, use multiway if statement to compute the m value based on month
If the original birth month is January or February: subtract from the year value. In our case, birth month is January, therefore, modified year year
For all other birthday months, do not subtract from the birth year, ie modified year year.
is the last two digits of the modified year. In this example, modified year
C stands for century: it's the first two digits of the modified year value. In our case,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started