Month Offset

Write a function to give you the "month offset" given a number representing the month. You can get the month offset from the table below.

Files Needed

Month offset
January 1
February 4
March 4
April 0
May 2
June 5
July 0
August 3
September6
October 1
November 4
Decemeber6
anything else-9999

What You Should See

Offset for month 1: 1
Offset for month 2: 4
Offset for month 3: 4
Offset for month 4: 0
Offset for month 5: 2
Offset for month 6: 5
Offset for month 7: 0
Offset for month 8: 3
Offset for month 9: 6
Offset for month 10: 1
Offset for month 11: 4
Offset for month 12: 6

Offset for month 43: -9999
Offset for month 17: -9999
Offset for month -1: -9999

Frequently-Asked Questions

I can get the code working, but I don't understand what the "month offset" means.
It's related to the day of the week a given month starts on. For example, in January 1, 2013 was a Tuesday (1 day from Monday). February 1 that same year was a Friday (4 days from Monday). March 1 was also a Friday (4 days from Monday). April 1 was a Monday (0 days from Monday).



©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License