Write a function to give you the "month offset" given a number representing the month. You can get the month offset from the following table:
| Month | Month offset | 
|---|---|
| 1 | 1 | 
| 2 | 4 | 
| 3 | 4 | 
| 4 | 0 | 
| 5 | 2 | 
| 6 | 5 | 
| 7 | 0 | 
| 8 | 3 | 
| 9 | 6 | 
| 10 | 1 | 
| 11 | 4 | 
| 12 | 6 | 
| anything else | -1 | 
Of course, here's the main() to test your function.
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: -1
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
![]()