判断星座

2018-11-11  17:12:34 开始写

 1 public static String getConstellation(int month, int day)
 2       {
 3         String[] constellations = { "魔蝎座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", 
 4           "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座" };
 5         int[] divide = { 19, 18, 20, 19, 20, 21, 22, 22, 22, 23, 22, 21 };
 6         if (day <= divide[(month - 1)]) {
 7           return constellations[(month - 1)];
 8         }
 9         if (month >= 12) {
10             month = 0;
11         }
12         return constellations[month];
13       }
原文地址:https://www.cnblogs.com/YUJIE666/p/9942650.html