[i]Name:[/i] [i]asset 1509[/i]
[i]Directives:[/i]
[i]~DEVOUR~ ~GROW~[/i]
[i]~DESTROY THE TRAITOR~[/i]
[i]Priority:[/i] [i]2nd Directive[/i]
[i]Status:[/i]
[i]~ACTIVE~[/i]
-
public class Zodiac { enum Mode { astrological, chinese; } enum astrologicalSigns { Aquarius, Pisces, Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn } enum chineseSigns { Monkey, Rooster, Dog, Pig, Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Ram } private Mode mode; public Zodiac() { this(Mode.astrological); } public Zodiac(Mode zodiacType) { this.mode = zodiacType; } public Mode getMode() { return mode; } public String showAstrologicalSign(String birthInfo) { String [] components = birthInfo.split("-"); String stringMonth = components[0]; String stringDay = components[1]; String stringYear = components[2]; int month = Integer.parseInt(stringMonth); int day = Integer.parseInt(stringDay); int year = Integer.parseInt(stringYear); if (mode == Mode.astrological) { if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) && (day < 0 || day > 31)) { System.err.print("Your birthdate input was invalid"); } else if ((month == 4 || month == 6 || month == 9 || month == 11) && (day <0 || day > 30)) { System.err.print("Your birthdate input was invalid"); } else if ((month == 2) && (day < 0 || day > 28)) { System.err.print("Your birthdate input was invalid"); } else { if ((month == 1 && day >= 20) || (month == 2 && day <= 18)) { birthInfo = astrologicalSigns.Aquarius.toString(); } else if ((month == 2 && day >= 19) || (month == 3 && day <= 20)) { birthInfo = astrologicalSigns.Pisces.toString(); } else if ((month == 3 && day >= 21) || (month == 4 && day <= 19)) { birthInfo = astrologicalSigns.Aries.toString(); } else if ((month == 4 && day >= 20) || (month == 5 && day <= 20)) { birthInfo = astrologicalSigns.Taurus.toString(); } else if ((month == 5 && day >= 21) || (month == 6 && day <= 20)) { birthInfo = astrologicalSigns.Gemini.toString(); } else if ((month == 6 && day >= 21) || (month == 7 && day <= 22)) { birthInfo = astrologicalSigns.Cancer.toString(); } else if ((month == 7 && day >= 23) || (month == 8 && day <= 22)) { birthInfo = astrologicalSigns.Leo.toString(); } else if ((month == 8 && day >= 23) || (month == 9 && day <= 22)) { birthInfo = astrologicalSigns.Virgo.toString(); } else if ((month == 9 && day >= 23) || (month == 10 && day <= 22)) { birthInfo = astrologicalSigns.Libra.toString(); } else if ((month == 10 && day >= 23) || (month == 11 && day <= 21)) { birthInfo = astrologicalSigns.Scorpio.toString(); } else if ((month == 11 && day >= 22) || (month == 12 && day <= 21)) { birthInfo = astrologicalSigns.Sagittarius.toString(); } else if ((month == 12 && day >= 22) || (month == 1 && day <= 20)) { birthInfo = astrologicalSigns.Capricorn.toString(); } else { System.err.println("Unknown birthsign. Please try again"); } } } if (mode == Mode.chinese) { if ((year < 1900) || (year > 2100)) { System.err.println("Your birthdate input was invalid"); } else { if (year % 12 == 0) { birthInfo = chineseSigns.Monkey.toString(); } else if (year % 12 == 1) { birthInfo = chineseSigns.Rooster.toString(); }else if (year % 12 == 2) { birthInfo = chineseSigns.Dog.toString(); } else if (year % 12 == 3) { birthInfo = chineseSigns.Pig.toString(); } else if (year % 12 == 4) { birthInfo = chineseSigns.Rat.toString(); } else if (year % 12 == 5) { birthInfo = chineseSigns.Ox.toString(); } else if (year % 12 == 6) { birthInfo = chineseSigns.Tiger.toString(); } else if (year % 12 == 7) { birthInfo = chineseSigns.Rabbit.toString(); } else if (year % 12 == 8) { birthInfo = chineseSigns.Dragon.toString(); } else if (year % 12 == 9) { birthInfo = chineseSigns.Snake.toString(); } else if (year % 12 == 10) { birthInfo = chineseSigns.Horse.toString(); } else if (year % 12 == 11) { birthInfo = chineseSigns.Ram.toString(); } } return birthInfo; } return birthInfo; } }