Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Method with Parameters | Методи
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Основи C#

bookChallenge: Method with Parameters

Завдання

Swipe to start coding

In this task, you will practice creating a method with multiple parameters that performs a calculation and returns a result.

  • Create a method CalculateFinalPrice that:
    • 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 finalTotal as a double.
  • In Main, call CalculateFinalPrice with example values and print the result using Console.WriteLine.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 6. Розділ 7
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Method with Parameters

Свайпніть щоб показати меню

Завдання

Swipe to start coding

In this task, you will practice creating a method with multiple parameters that performs a calculation and returns a result.

  • Create a method CalculateFinalPrice that:
    • 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 finalTotal as a double.
  • In Main, call CalculateFinalPrice with example values and print the result using Console.WriteLine.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 6. Розділ 7
single

single

some-alt