Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Methods Creation | Metoder
C#-Grunder

bookChallenge: Methods Creation

Uppgift

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.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 6. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Methods Creation

Svep för att visa menyn

Uppgift

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 6. Kapitel 4
single

single

some-alt