This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2014:cprog:projects:dayofweek [2014/02/06 17:32] – [Objective] wedge | haas:spring2014:cprog:projects:dayofweek [2014/02/06 17:39] (current) – [Reflection] wedge | ||
---|---|---|---|
Line 16: | Line 16: | ||
* all requests will be for days in the 21st century (2000-2099) | * all requests will be for days in the 21st century (2000-2099) | ||
- | =====Prerequisites===== | + | =====Prerequisites/ |
In addition to the new skills required on previous projects, to successfully accomplish/ | In addition to the new skills required on previous projects, to successfully accomplish/ | ||
Line 41: | Line 41: | ||
In our example, we're working with 2014, the last two digits are therefore: 14 | In our example, we're working with 2014, the last two digits are therefore: 14 | ||
- | You should be able to come up with a means of extracting this information. | + | You should be able to come up with a means of extracting this information |
===Step 2: Compute 25% (drop the decimal)=== | ===Step 2: Compute 25% (drop the decimal)=== | ||
Line 90: | Line 90: | ||
Go and reference the 3 from that table... what day do we get? Does it match the actual day of the week for January 1st, 2014? | Go and reference the 3 from that table... what day do we get? Does it match the actual day of the week for January 1st, 2014? | ||
+ | |||
+ | <cli> | ||
+ | lab46:~$ cal 01 2014 | ||
+ | January 2014 | ||
+ | Su Mo Tu We Th Fr Sa | ||
+ | 1 2 3 4 | ||
+ | | ||
+ | 12 13 14 15 16 17 18 | ||
+ | 19 20 21 22 23 24 25 | ||
+ | 26 27 28 29 30 31 | ||
+ | |||
+ | lab46: | ||
+ | </ | ||
Pretty neat, eh? | Pretty neat, eh? | ||
Line 121: | Line 134: | ||
* 2000 by definition isn't a leap year, but how does this algorithm work for 2000 in general? | * 2000 by definition isn't a leap year, but how does this algorithm work for 2000 in general? | ||
* Try this algorithm on some years in the 20th century and see how it fares. | * Try this algorithm on some years in the 20th century and see how it fares. | ||
- | * Is it correct? Is it correct for all of them? | + | * Is it correct? Is it correct for any of them? |
* If it isn't correct, is it consistently off by a value? | * If it isn't correct, is it consistently off by a value? | ||