UVa 11947 - Cancer or Scorpio

11947 - Cancer or Scorpio

 * http://uva.onlinejudge.org/external/119/11947.html

Summary
Given a date, add 40*7 days to the date, print the zodiac of the new date. The zodiacs are given as a date range.

Explanation
Use Java's Calendar to create the date and advance 40*7 days. Use Java's GregorianCalendar to create date range for the zodiacs. It's only a matter of checking whether the date is between a certain range.

Gotchas

 * Java's Calendar using month from index 0, while the date is from index 1.
 * Be careful for Capricorn's zodiac, its date range wraps around the year.

Input
2 01232009 01232008

Output
1 10/30/2009 scorpio 2 10/29/2008 scorpio