java根据字符串类型(bar或KTV)获得奖品名称,这里奖品是3个轮流发送
2009-04-23 20:54:50 来源:WEB开发网 /**
* 根据字符串类型(bar或KTV)获得奖品名称,这里奖品是3个轮流发送<br>
*
* @param barType
* @return
*/
PRivate String getAwardName(String barType) {
String awardName = "";
String[] strsBar = {"金属钱夹", "金属袖扣", "迷你酒伴"};
String[] strsKtv = {"现金券", "一小时欢唱", "二小时欢唱"};
int BarCount = 0;
int KtvCount = 0;
if (barType.equals("bar")) {
if (BarCount % 3 == 0) {
awardName = strsBar[0];
BarCount++;
} else if (BarCount % 3 == 1) {
awardName = strsBar[1];
BarCount++;
} else {
awardName = strsBar[2];
BarCount++;
}
} else if (barType.equals("ktv")) {
if (KtvCount % 3 == 0) {
awardName = strsKtv[0];
KtvCount++;
} else if (KtvCount % 3 == 1) {
awardName = strsKtv[1];
KtvCount++;
} else {
awardName = strsKtv[2];
KtvCount++;
}
}
return awardName;
}
更多精彩
赞助商链接