Answered step by step
Verified Expert Solution
Link Copied!

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 2170 OLA 1
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:
1372001=> 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:
f=d+13**m-15+D+D4+C4-2**C.,larr declare all variables to be of integer type
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 11 th and 12 th months of the previous year. In our example, m=11.(use multiway if statement to compute the m value based on month)
If the original birth month is January or February: subtract 1 from the year value. In our case, birth month is January, therefore, modified year = year -1=2064-1=2063.
For all other birthday months, do not subtract 1 from the birth year, i.e., modified year = year.
D is the last two digits of the modified year. In this example, D= modified year %100=2063%100=63.
C stands for century: it's the first two digits of the modified year value. In our case, C=2063100=20.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago