セクション 1. 章 55
single
Challenge: Method with Parameters
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
In this task, you will practice creating a method with multiple parameters that performs a calculation and returns a result.
- Create a method
CalculateFinalPricethat:- Accepts three parameters:
itemPrice(double)quantity(int)discount(double)
- Calculates the total price:
total = itemPrice * quantity. - Applies the discount:
finalTotal = total - (total * discount / 100). - Returns the
finalTotalas adouble.
- Accepts three parameters:
- In
Main, callCalculateFinalPricewith example values and print the result usingConsole.WriteLine.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 55
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください