Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Operators | Getting Started
C# Basics

bookChallenge: Operators

Note
Note

In these tasks, the Main method is already implemented. You need to write your solution in the additional method where the placeholders are provided.

Task

Swipe to start coding

  • You are creating a simple store calculator. The calculator should compute the total price, discount, tax, and final price for items in a store.

  • Complete the RunStoreCalculator method by filling in the missing parts (___) to correctly calculate:

    • To calculate the total price, multiply the price of a single item by the quantity of items.

    • To calculate the discount amount, multiply the totalPrice by discountPercent and then divide by 100 to convert the percentage into a value.

    • To calculate the tax amount, first subtract the discountAmount from the totalPrice to get the price after discount, then multiply by taxPercent and divide by 100.

    • To calculate the final price, subtract the discountAmount from the totalPrice, then add the taxAmount to get the final total the customer needs to pay.

  • Print all values with clear labels inside the method.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 10
single

single

Ask AI

expand

Ask AI

ChatGPT

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

close

bookChallenge: Operators

Swipe to show menu

Note
Note

In these tasks, the Main method is already implemented. You need to write your solution in the additional method where the placeholders are provided.

Task

Swipe to start coding

  • You are creating a simple store calculator. The calculator should compute the total price, discount, tax, and final price for items in a store.

  • Complete the RunStoreCalculator method by filling in the missing parts (___) to correctly calculate:

    • To calculate the total price, multiply the price of a single item by the quantity of items.

    • To calculate the discount amount, multiply the totalPrice by discountPercent and then divide by 100 to convert the percentage into a value.

    • To calculate the tax amount, first subtract the discountAmount from the totalPrice to get the price after discount, then multiply by taxPercent and divide by 100.

    • To calculate the final price, subtract the discountAmount from the totalPrice, then add the taxAmount to get the final total the customer needs to pay.

  • Print all values with clear labels inside the 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Β 10
single

single

some-alt