Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Income Tax Calculation | Fundamentals and Functional Capabilities of Stream API
Stream API
course content

Contenido del Curso

Stream API

Stream API

1. Fundamentals and Functional Capabilities of Stream API
4. Practical Applications of Stream API

book
Challenge: Income Tax Calculation

Tarea

Swipe to start coding

Implement a program that calculates taxes based on income brackets, applying different tax rates depending on the income level.

  • If the income is over 100,000, the tax rate is 25%.
  • If the income is between 50,000 and 100,000, the tax rate is 15%.
  • If the income is below 50,000, the tax rate is 5%.

  1. Set the appropriate values in if and else if for the income conditions.
  2. Multiply the amount by the appropriate percentage in each case to get the correct tax amount.
  3. In the calculateTaxes method, iterate through the income array using a for-each loop.
  4. Add the tax for each income to the result list by using the taxFunction functional interface passed as a parameter.
  5. Store the result of the calculateTaxes method in the taxes variable.

Solución

java

solution

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 7
toggle bottom row

book
Challenge: Income Tax Calculation

Tarea

Swipe to start coding

Implement a program that calculates taxes based on income brackets, applying different tax rates depending on the income level.

  • If the income is over 100,000, the tax rate is 25%.
  • If the income is between 50,000 and 100,000, the tax rate is 15%.
  • If the income is below 50,000, the tax rate is 5%.

  1. Set the appropriate values in if and else if for the income conditions.
  2. Multiply the amount by the appropriate percentage in each case to get the correct tax amount.
  3. In the calculateTaxes method, iterate through the income array using a for-each loop.
  4. Add the tax for each income to the result list by using the taxFunction functional interface passed as a parameter.
  5. Store the result of the calculateTaxes method in the taxes variable.

Solución

java

solution

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 7
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt