Question
Part 1: Get the Date In this part you will ask the user to enter in the date they wish to apply Zeller's Rule on.
Part 1: Get the Date In this part you will ask the user to enter in the date they wish to apply Zeller's Rule on. You must ask for the month, day, and year separately. We will assume the inputs will be numeric scalars that represent the date, and that the dates they enter will be valid ones (February 31st is an invalid date). As an example, February 5, 2021 will be given as 2,5, 2021 for the inputs. Part 2: Zeller's Rule If we assume the day is a valid date, we will implement Zeller's Rule for the date by performing the algorithm outlined below: 1. If the month is January or February, decrease the year by 1 and add 10 to the month's numeric value 2. If the month is any other month than January or February, decrease the month by 2 3. Extract the last two digits of the year (we will call this value D) a. We need this as a numeric value, not as text 4. Extract the first two digits of the year (we will call this value C) a. We need this as a numeric value, not as text 5. Calculate the factor given by the following equation: 13* month - 1 factor = day + -> + D + + 5*C 5 Here, anything in the ) denotes that it should be rounded down to the nearest integer. +*+5=0 Part 3: Determine Day of the Week Once we have determined the factor value: C. 1. Divide the factor by 7 and determine the remainder of the division 2. The remainder corresponds to the day of the week: a. 0 - Sunday b. 1 - Monday 2- Tuesday d. 3-Wednesday e. 4 - Thursday f. 5- Friday g 6- Saturday 3. Print out the original date and the day of the week Print out the month value as text (January through December) b. You may not use a conditional to print the month as text (no if-statements or switch- statements here) a. Sample Output: This is a sample of what the program should show in the command window. If the user enters any information, it will be highlighted in RED: Enter the month (1-12): 2 Enter the day: 5 Enter the year: 2021 February 5, 2021 is a Friday
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