Секція 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
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат