Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task S: Doomsday Algorithm for the Last Time A year's Doomsday is given by the equation: Doomsday (((yr // 12) + (yr % 12) +

image text in transcribed
Task S: Doomsday Algorithm for the Last Time A year's Doomsday is given by the equation: Doomsday (((yr // 12) + (yr % 12) + (yr % 12) // 4) % 7 + anchor) % 7 (1) where yr is the last two digits of the year and the anchor day is an integer between 0 and 6 with 0 corresponding to Sunday and 6 to Saturday Previously you've written three functions for the Doomsday algorithm, set anchor), which takes as its parameter the first two digits of the year and returns a 2 if the digits are 20 and a 3 if the digits are 19, calc.doom ), which calculates the doomsday using the algorithm given above and a main () function, which prompts for a four-digit integer year, extracts the first two and last two digits, calls the two functions previously described, and then prints out the Doomsday. Today you'll finish up the Doomsday algorithm by writing one more function and altering main). Thus, for this task: Write a non-void function get.day that takes as its parameter the doomsday calcula by calc.doom(), determines which day of the week it represents (0-Sunday),and returns this day to main(). Use the if-elif-else construct. . Alter your main ( ) function for Lab #5 so that it prompts the user for a four-digit integer year, extracts the first two and last two digits of the year, calls set.anchor which returns the anchor, calls calc.doom () which returns the doomsday, and finally calls get.day ) to determine the day of the week which it then prints as the Doomsday Anchor days for 2000-2099 are Tuesday (-2) and for 1900-1999 Wednesday(3).Example results are shown below Enter the year in four digits: 1966 Doomsday: Monday Enter the year in four digits: 2019 s Doomsday: Thursday Save this again as doom.py but to folder Lab6 in CS111. Run the program for your TA to get credit. Now you know the actual day of the Doomsday

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

Students also viewed these Databases questions

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago