I've had people send me "please do my homework" email before, but never have I had anyone be quite so unabashed about it. Check this out:
------------------------------------
my email is [removed to protect the clueless]
can u help.
do you know how to write the code for doomsday day of the week in assembly without using a branch statement in m6800 motorolla series family
here is the specs:
The Program:
program will prompt the user to enter a date: "Please enter a date (mm/dd/yyyy):". Next, the program will read the date entered at the keyboard, and calculate the day of the week for the given date. Finally, the program will print "The day of the week is: " followed by a new line and the day (Sunday .. Saturday). Example:
--------------------------------------------------------------------------------
Please enter a date (mm/dd/yyyy):
10/02/2003
The day of the week is:
Thursday
--------------------------------------------------------------------------------
Additional Details:
a.. Your program will assume only dates in the Gregorian calendar. This is the calendar in common use today. [For background information about calendars see: http://www.tondering.dk/claus/cal/calendar26.html. The algorithm given below is from this source.]
b.. Since the Gregorian calendar was not in widespread use until the 1700's, your program will handle dates in the range 01/01/1800 to 12/31/9999.
c.. All input must consist of a two digit month and day, and a four digit year, separated by the "/" character (mm/dd/yyyy). i.e. February 1, 2000 would be written 02/01/2000. You do not have to validate the date; if the user input does not conform to the specification, then we would expect the answer to be garbage.
d.. All 'variables' given in the algorithm are 16 bit values. Since there are only seven of them, you should use data registers for them.
e.. All division is integer division. If you use a calculator to verify your calculation, you may get a different answer because calculators use floating point division.
f.. The algorithm returns an integer value (the variable 'd') in the range 0 .. 7 which correspond to Sunday .. Saturday. i.e. 0=Sunday, 1=Monday, 2=Tuesday etc. Given this integer value, your program must print the correct day.
g.. Your program may not contain any branch instructions. You'll need to do address arithmetic to print the correct day.
h.. Documentation is always important, but particularly so with assembly language programs. Be sure to document the steps carefully.
i.. Your program must implement the algorithm given below.
The Algorithm:
For Gregorian Calendar:
VARIABLES:
Read from the keyboard:
month
day
year
Calculated:
a = (14-month)/12
y = year - a
m = month + 12a - 2
d = (day + y + y/4 - y/100 + y/400 + 31m/12) mod 7
--------------------------------------------------------------------------------
Example:
August 2, 1953
a = (14 - 8)/12 = 0
y = 1953 - 0 = 1953
m = 8 + 12 x 0 - 2 = 6
d = (2 + 1953 + 1953/4 - 1953/100 + 1953/400 + (31x6)/12) mod 7
d = (2 + 1953 + 488 - 19 + 4 + 15) mod 7
d = 2443 mod 7
d = 0
0 is Sunday.
Algorithm from Claus Tøndering
Wha . . . what?!?
*as his mind turns to mush*
Posted by: Mr. Hibbity Gibbity on October 14, 2003 08:24 PMBrian's test score on an English test was 80%. If there were 45 problems on the test, then how many did he miss?
Posted by: on November 23, 2003 09:13 PM