java通过生日得到星座

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chunlongyuan/article/details/8565102
	private final static int[] dayArr = new int[] { 20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22 };
	private final static String[] constellationArr = new String[] { "摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座" };


	public static String getConstellation(int month, int day) {
		return day < dayArr[month - 1] ? constellationArr[month - 1] : constellationArr[month];
	}

猜你喜欢

转载自blog.csdn.net/chunlongyuan/article/details/8565102