对于居住在阿拉斯加的客户,订单的固定费率运费为50美元,对于居住在夏威夷的客户为60美元;对于所有其他州,它是30.00美元。客户还可以选择加急运费,无论其交付状态如何,均为120美元。
我所做的:
if (expedited.isSelected()) {
shippingCost=120;
}
if (state.getSelectedItem() == "AK ") {
shippingCost=50;
}
if (state.getSelectedItem() == "HI ") {
shippingCost=60;
} else {
shippingCost=30;
}
答案 0 :(得分:0)
decimal CalculateShippingCost(bool expedited, string state)
{
if (expedited)
return 120;
if (state == "AK ")
return 50;
if (state == "HI ")
return 60;
return 30;
}