Last active
March 31, 2016 17:28
-
-
Save syneart/f6b94d1fc9fb49246bd3 to your computer and use it in GitHub Desktop.
星座判斷
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Constellation_main { | |
public static void main(String[] args) { | |
System.out.println(getConstellationFromDate("10/01")); | |
} | |
private static String getConstellationFromDate(String strBirthday) { | |
int intBirthday = Integer.valueOf(strBirthday.replace("/","")); | |
if (intBirthday < 11 | intBirthday > 1231) { | |
return "博愛座"; | |
} | |
if (intBirthday < 121 | intBirthday > 1221) { | |
return "摩羯座"; | |
} else if (intBirthday < 219) { | |
return "水瓶座"; | |
} else if (intBirthday < 321) { | |
return "雙魚座"; | |
} else if (intBirthday < 420) { | |
return "牡羊座"; | |
} else if (intBirthday < 521) { | |
return "金牛座"; | |
} else if (intBirthday < 622) { | |
return "雙子座"; | |
} else if (intBirthday < 723) { | |
return "巨蟹座"; | |
} else if (intBirthday < 823) { | |
return "獅子座"; | |
} else if (intBirthday < 923) { | |
return "處女座"; | |
} else if (intBirthday < 1024) { | |
return "天秤座"; | |
} else if (intBirthday < 1123) { | |
return "天蠍座"; | |
} else if (intBirthday < 1222) { | |
return "射手座"; | |
} else { | |
return "博愛座"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so cool!!