代寫C C++ Java Python 視頻講解客服在線客服在線

代做國外C C++ Java程序 Python QQ 2365427650 Email [email protected] 免費咨詢編程問題

« ArrayListsFifteen Twenty Game »

Write the program in MIPS

Write the program to calculate the day of the week of birth. The day, month and year of birth
should be input. Based on these inputs the day of the week of birth is calculated as follows:
a. Divide the last two digits of the birth year by 4. Put the quotient (ignoring the remainder)
in TOTAL. For example, if the person was born in 83, divide 83 by 4 and store 20 in TOTAL.
b. Add the last two digits of the birth year to TOTAL. TOTAL now contains 103.
c. Add the last two digits of the birth date to TOTAL. If born on May 10, add 10. TOTAL now
contains 113.
d. Using the following table, find the "month number" and add to TOTAL.
January = 1
February = 4
March = 4
April = 0
May = 2
June = 5
July = 0
August = 3
September = 6
October = 1
November = 4
December = 6 ; In our example: TOTAL now contains 115.
e. If the year is leap year and if the month you are working with is either January or February,
then
subtract 1 from the total. TOTAL now contains 115.
Which years are leap years?
In the Gregorian calendar, which is the calendar used by most modern countries, the following
rules decides which years are leap years:
1. Every year divisible by 4 is a leap year.
2. But every year divisible by 100 is NOT a leap year
3. Unless the year is also divisible by 400, then it is still a leap year.
f. Divide first two digits of the year by 4. Let the reminder is a. Please follow the below logic.

if a= 0, add 6 with TOTAL
if a= 1, add 4 with TOTAL
if a= 2, add 2 with TOTAL
if a= 3, add 0 with TOTAL
For example, add 6 for years 2000 to 2099 (20%4=0); add 4 for years 1700 to 1799 (17%4=1);
add 2 for 1800 to 1899 (18%4= 2); add 0 for 1900 to 1999 (19%4=3) with TOTAL.
g. Find the
remainder when TOTAL is divided by 7. Look up the remainder in following table to
determine the day of the week the person was born on. Note that you should not use this
procedure if a person's birth year is earlier than 1900. TOTAL = 115, TOTAL % 7 = 3. Therefore
May 10, 1983 was a Tuesday.
1 = Sunday
2 = Monday
3 = Tuesday
4 = Wednesday
5 = Thursday
6 = Friday
0 = Saturday
Example Input:
Input Month -> 5
Input Day -> 10
Input Year -> 1983
Example output:
A person born on May 10, 1983 was born on a Tuesday.
Submission Guidelines:
Please submit the completed .asm file and comment each of the code block to describe
the purpose.
Please submit the snapshots of the output of the .asm file based on the below inputs.
Check your results and you will find
“Tuesday” for all the below inputs.   CSCI 370: Project
a) May 10, 1983
(non-leapyear)
b) May 8, 1984 (leapyear)
c) Feb 16, 2016 (leapyear)
d) June 13, 2000 (leapyear)
e) Feb 15, 2000 (leapyear)
f) July 13, 2100 (non-leapyear)
g) Feb 16, 2100 (non-leapyear)



  • 相關文章:

發表評論:

◎歡迎參與討論,請在這里發表您的看法、交流您的觀點。

最新評論及回復

最近發表

Powered By Z-Blog 1.8 Walle Build 100427

Copyright 代寫C.

体彩25选5开奖结果