2 回答
TA贡献2051条经验 获得超10个赞
您想切换变量 ct
switch(ct) {
case CustomeType.retail:
/*Command*/
break;
case CustomerType.TRADE:
/*Command*/
break;
default:
/*else*/
}
TA贡献1796条经验 获得超7个赞
试试这个:(很简单)
public static double getDiscountPercent(CustomerType ct) {
double discountPercent = 0;
switch(ct) {
case CustomerType.RETAIL :
discountPercent = 0.156;
break;
case CustomerType.TRADE :
discountPercent = 0.30;
break;
case CustomerType.COLLEGE :
discountPercent = 0.20;
break;
default :
discountPercent = 0;
}
return discountPercent;
}
添加回答
举报