public void CalculateFee(ShippingProduct product) { var weight = product.Weight; if (weight > 20) { product.ShippingFee = 500; } else { product.ShippingFee = 100 + weight * 10; } }
public void CalculateFee(ShippingProduct product) { var size = product.Size.Length * product.Size.Width * product.Size.Height; //長 x 寬 x 高(公分)x 0.0000353 if (product.Size.Length > 100 || product.Size.Width > 100 || product.Size.Height > 100) { product.ShippingFee = size * 0.0000353 * 1100 + 500; } else { product.ShippingFee = size * 0.0000353 * 1200; } }
public void CalculateFee(ShippingProduct product) { var weight = product.Weight; var feeByWeight = 80 + weight * 10; var size = product.Size.Length * product.Size.Width * product.Size.Height; var feeBySize = size * 0.0000353 * 1100; if (feeByWeight < feeBySize) { product.ShippingFee = feeByWeight; } else { product.ShippingFee = feeBySize; } }