Challenge: Method with Parameters
Tarea
Swipe to start coding
In this task, you will practice creating a method with multiple parameters that performs a calculation and returns a result.
- Create a method
CalculateFinalPricethat:- Accepts three parameters:
itemPrice(double)quantity(int)discount(double)
- Calculates the total price:
total = itemPrice * quantity. - Applies the discount:
finalTotal = total - (total * discount / 100). - Returns the
finalTotalas adouble.
- Accepts three parameters:
- In
Main, callCalculateFinalPricewith example values and print the result usingConsole.WriteLine.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 6. Capítulo 7
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Genial!
Completion tasa mejorada a 1.25
Challenge: Method with Parameters
Desliza para mostrar el menú
Tarea
Swipe to start coding
In this task, you will practice creating a method with multiple parameters that performs a calculation and returns a result.
- Create a method
CalculateFinalPricethat:- Accepts three parameters:
itemPrice(double)quantity(int)discount(double)
- Calculates the total price:
total = itemPrice * quantity. - Applies the discount:
finalTotal = total - (total * discount / 100). - Returns the
finalTotalas adouble.
- Accepts three parameters:
- In
Main, callCalculateFinalPricewith example values and print the result usingConsole.WriteLine.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 6. Capítulo 7
single