Question: Need help with Python Assignment Use the Ziller formula to calculate the day of the week. NOTE that youre providing the solution to both problems

Need help with Python Assignment

Use the Ziller formula to calculate the day of the week. NOTE that youre providing the solution to both problems in ONE Python source file. We dont need to know anything about the Zillers rule to write this program. Mr. Ziller developed a formula to calculate the day of the week. You tell the formula what it needs, it comes back with the day of the week. Make sure the prompts are very descriptive.

  1. H = (q + 26(m+1)/10 + k + k/4 + j/4 + 5j) % 7

  2. H is the calculated day of the week. 0: Saturday, 1: Sunday, 6: Friday. Your program should output the name of the day and not the number.

  3. q is the day of the month (1-31)

  4. m is the month number (3: March, 4: April, , 12: December). January and February are counted as month 13 and 14 of previous year.

  5. MAJOR HINT: For January, your code must convert the user input to 13 and for February, your code must convert the user input to 14 and change the year to the previous year in both cases. I see a couple of nice and short if statements here.

  6. j is the century (year / 100)

  7. k is the year of the century (year % 100)

Note that the division in the formula should be integer division. Otherwise, the formula wont work!

  • Ask the user to enter a year, month number (m), and day of the month (q). Make sure to ask for the values in the given order.

  • If the month number is not a valid number between 1 and 12, issue an error message and do no not report the day of the week.

  • If the day of the month is not a valid number between 1 and 31, issue an error message and do no not report the day of the week.

  • Calculate and display the name of the day of the week.

Sample interaction 1: Im NOT using a loop here. This is just your program being run each time.

Please input year. 2015

Please input month. (1-12) 1

Please input day of the month. (1-31) 25

Sunday

Sample interaction 2:

Please input year. 2020

Please input month. (1-12) 9

Please input day of the month. (1-31) 7

Monday

Sample interaction 3:

Please input year. 2020

Please input month. (1-12) 15

Please input day of the month. (1-31) 7

Monday

Sample interaction 4:

Please input year. 2012

Please input month. (1-12) 13 ERROR - Invalid month number

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!