Challenge: Operators
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
RunStoreCalculatormethod by filling in the missing parts (___) to correctly calculate:-
To calculate the total price, multiply the
priceof a single item by thequantityof items. -
To calculate the discount amount, multiply the
totalPricebydiscountPercentand then divide by 100 to convert the percentage into a value. -
To calculate the tax amount, first subtract the
discountAmountfrom thetotalPriceto get the price after discount, then multiply bytaxPercentand divide by 100. -
To calculate the final price, subtract the
discountAmountfrom thetotalPrice, then add thetaxAmountto get the final total the customer needs to pay.
-
-
Print all values with clear labels inside the method.
Lösung
Danke für Ihr Feedback!
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Großartig!
Completion Rate verbessert auf 1.52
Challenge: Operators
Swipe um das Menü anzuzeigen
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
RunStoreCalculatormethod by filling in the missing parts (___) to correctly calculate:-
To calculate the total price, multiply the
priceof a single item by thequantityof items. -
To calculate the discount amount, multiply the
totalPricebydiscountPercentand then divide by 100 to convert the percentage into a value. -
To calculate the tax amount, first subtract the
discountAmountfrom thetotalPriceto get the price after discount, then multiply bytaxPercentand divide by 100. -
To calculate the final price, subtract the
discountAmountfrom thetotalPrice, then add thetaxAmountto get the final total the customer needs to pay.
-
-
Print all values with clear labels inside the method.
Lösung
Danke für Ihr Feedback!
single