Introduction to Computer Science II for non-majors by James Tam |
Aside from the 'main' method you are not to write static methods for this assignment. (If you don't know what I'm referring to by static methods, I will be discussing this topic later in the course).
Write a program that will prompt the user for their birth month and the day of the month that the person was born. If a numeric value outside of 1 - 12 was entered for the month then the program should indicate that only a value from 1 - 12 is valid for the month and re-prompt for the information until a valid value has been entered. Your program does not have to handle cases where the user enters the name of the month (e.g., 'Mar', 'November' etc.) rather than a numeric value. Once a valid month has been entered then the program should prompt the user for the day of the month that they were born. The program should re-prompt for the day if an invalid value (<1) or (>31) has been entered or if the day of the month entered exceeds the maximum number of days in a particular month (e.g., a person can't be born on the 30th of February). You don't have to worry about the effect of a leap year for this assignment.
Finally the program should then display the user's astrological sign which is determined by the day/month that he or she was born. For your reference here is the mapping:
Capricorn | Aquarius | Pisces | Aries | Taurus | Gemini | Cancer | Leo | Virgo | Libra | Scorpio | Sagittarius |
Dec 22 - Jan 19 | Jan 20 - Feb 18 | Feb 19 - Mar 20 | Mar 21 - Apr 19 | Apr 20 - May 20 | May 21 - Jun 21 | Jun 22 - Jul 22 | Jul 23 - Aug 22 | Aug 23 - Sep 22 | Sep 23 - Oct 22 | Oct 23 - Nov 21 | Nov 22 - Dec 21 |