Hello, i am having trouble figuring out the correct method coding for this java
ID: 3732392 • Letter: H
Question
Hello, i am having trouble figuring out the correct method coding for this java test and any help is appreciated the problem asked that i use conditionals
. In this tax, the deduction for your dependents depends on the number of children you have. The first three children result in deductions of $1000 each, but if you have four or more children, each result in a deduction of $1100. Your tax is computed from your adjusted income as follows: 0-19, 999.99: 5% 20,000-and up: 15% est blic void testTwoLevelDeductions () TaxCalculator tc new TaxCa!culator(); assertEquals( assertEquals (19999.99*0.05, tc. twolevelDeductions (19999.99+4400, 4),0.001) assertEquals (20000 0.15, tc.twoLevelDeductions (23000, 3), 0.001) assertEquals (20000 0.15, tc.twoLevelDeductions (24400, 4), 0.001)Explanation / Answer
public class TaxCalculator { public double twoLevelDeductions(double amount, int children) { if(children >= 4) { amount -= children*1100; } else { amount -= children*1000; } if(amountRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.