Challenge: Methods Creation
Task
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
itemPriceandquantity. - Calculates the total price as
itemPrice * quantity. - Print the result using
Console.WriteLine
- In
Main, call this method.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Awesome!
Completion rate improved to 1.67
Challenge: Methods Creation
Swipe to show menu
Task
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
itemPriceandquantity. - Calculates the total price as
itemPrice * quantity. - Print the result using
Console.WriteLine
- In
Main, call this method.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 3
single