Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Operators | Komma Igång
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C#-Grunder

bookChallenge: Operators

Uppgift

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.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 14
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

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me a real-world example?

close

bookChallenge: Operators

Svep för att visa menyn

Uppgift

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.

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 1. Kapitel 14
single

single

some-alt