Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Methods Creation | Méthodes
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Bases de C#

bookChallenge: Methods Creation

Tâche

Swipe to start coding

You run a small store. Each order has a fixed price per item and quantity. Your task is to calculate the total price using a separate method.

  • Create a method (CalculateTotalPrice) that:
    • Does not take any parameters.
    • Uses hardcoded values for itemPrice and quantity.
    • Calculates the total price as itemPrice * quantity.
    • Print the result using Console.WriteLine
  • In Main, call this method.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 6. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Methods Creation

Glissez pour afficher le menu

Tâche

Swipe to start coding

You run a small store. Each order has a fixed price per item and quantity. Your task is to calculate the total price using a separate method.

  • Create a method (CalculateTotalPrice) that:
    • Does not take any parameters.
    • Uses hardcoded values for itemPrice and quantity.
    • Calculates the total price as itemPrice * quantity.
    • Print the result using Console.WriteLine
  • In Main, call this method.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 6. Chapitre 4
single

single

some-alt