Challenge: Income Tax Calculation
Tarefa
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%.
- Set the appropriate values in
ifandelse iffor the income conditions. - Multiply the amount by the appropriate percentage in each case to get the correct tax amount.
- In the
calculateTaxesmethod, iterate through the income array using afor-eachloop. - Add the tax for each income to the
resultlist by using thetaxFunctionfunctional interface passed as a parameter. - Store the result of the
calculateTaxesmethod in thetaxesvariable.
Solução
solution.java
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 7
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Resumir este capítulo
Explicar o código em file
Explicar por que file não resolve a tarefa
Awesome!
Completion rate improved to 2.33
Challenge: Income Tax Calculation
Deslize para mostrar o menu
Tarefa
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%.
- Set the appropriate values in
ifandelse iffor the income conditions. - Multiply the amount by the appropriate percentage in each case to get the correct tax amount.
- In the
calculateTaxesmethod, iterate through the income array using afor-eachloop. - Add the tax for each income to the
resultlist by using thetaxFunctionfunctional interface passed as a parameter. - Store the result of the
calculateTaxesmethod in thetaxesvariable.
Solução
solution.java
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 7
single