Question: Implement an algorithm in MIPS that takes a given year as input and subsequently calculates a Doomsday number. (This number can then be used to
Implement an algorithm in MIPS that takes a given year as input and subsequently calculates a Doomsday number. (This number can then be used to determine the day of a particular date.)
Each century has a so-called "anchor day" that will be used in the algorithm.
Century, Anchor day, Index (day of week)
1800-1999, Friday, 5
1900-1999, Wednesday, 3
2000-2099, Tuesday, 2
2100-2199,Sunday, 0
Next, we find the year's doomsday. To accomplish that according to Conway:
Divide the year's last two digits (call this y) by 12 and let a be the floor of the quotient
Let b be the remainder of the same quotient.
Divide that remainder by 4 and let c be the floor of the quotient.
Let d be the sum of the three numbers (d = a + b + c). (It is again possible here to divide by seven and take the remainder. This number is equivalent, as it must be, to the sum of the last two digits of the year taken collectively plus the floor of those collective digits divided by four.)
Count forward the specified number of days (d or the remainder of d/7) from the anchor day to get the year's doomsday.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
