セクション 1. 章 10
single
Challenge: Calculate Shipping Cost
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
You are building a shipping cost calculator that computes the final shipping price for a product based on its weight and selected delivery option.
- Inside the function
calculateShipping, set the initialshippingPriceto 10% ofproductPrice. - If the product's weight exceeds 25 pounds, add an additional $2.25 to
shippingPrice. - Use a
switchstatement on theoptionparameter:- Case 1 → add $0.3 to
shippingPrice. - Case 2 → add $0.5 to
shippingPrice. - Case 3 → add $1.75 to
shippingPrice. - Default → do nothing.
- Case 1 → add $0.3 to
- Return the value of
shippingPricefrom the function.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 10
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください