Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Methods Creation | Section
C# Basics
Sectionย 1. Chapterย 53
single

single

bookChallenge: 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 itemPrice and quantity.
    • Calculates the total price as itemPrice * quantity.
    • Print the result using Console.WriteLine
  • In Main, call this method.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 1. Chapterย 53
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt