Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Method with Parameters | Metodi
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Fondamenti di C#

bookChallenge: Method with Parameters

Compito

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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 7
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Method with Parameters

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 7
single

single

some-alt