1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| package com.simplewen.win0.checkluckybound
class Constellation{ companion object { fun star(m:Int,d:Int):String{ var res = "格式错误!" val date = intArrayOf(20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22) val index = m val luckyData = arrayListOf<Map<String,Any>>( mapOf("星座:" to "摩羯座,诞生石:土耳其玉" ), mapOf("星座:" to "水瓶座,诞生石:紫水晶"), mapOf("星座:" to "双鱼座,诞生石:月长石" ), mapOf("星座:" to "白羊座,诞生石:钻石" ), mapOf("星座:" to "金牛座,诞生石:蓝宝石" ), mapOf("星座:" to "双子座,诞生石:玛瑙" ), mapOf("星座:" to "巨蟹座,诞生石:珍珠" ), mapOf("星座:" to "狮子座,诞生石:红宝石"), mapOf("星座:" to "处女座,诞生石:红条纹玛瑙" ), mapOf("星座:" to "天秤座,诞生石:蓝宝石" ), mapOf("星座:" to "天蝎座,诞生石:猫眼石" ), mapOf("星座:" to "射手座,诞生石:黄宝石" ), mapOf("星座:" to "摩羯座,诞生石:土耳其玉") ) when(m){ 1,2,3,4,5,6,7,8,9,10,11,12->{ when(d){ in 1..31 -> if(d < date[m-1]){ res = luckyData[index-1]["星座:"].toString() }else{
res = luckyData[index]["星座:"].toString() } else -> res = "天数格式错误!" }
} else ->{ res = "月份格式错误!" } }
return res } }
}
|