Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the following income ranges and corresponding tax rates: under $25,000= 2% i

ID: 3532789 • Letter: U

Question

Use the following income ranges and corresponding tax rates:

under $25,000= 2% income tax

$25,000-$49,999=5% income tax

$50,000-$74,999=10% income tax

$75,000-99,999= 15% income tax

$100,000 and over = 20% income tax


c) In the calculateJJButtonActionPerformed method (lines 110-118 in the template), insert a switch statement at line 114 to determine the tax rate and assign it to the double variable taxRate (declared on line 112). The int variable salary (line 113) contains the salary input by the user. Use the controlling expression salary / 25,000 to determine the tax rate. If the salary is less than $25000, the controlling expression's value will be 0. For salaries in the range $25,000-$49,999, the controlling expression's value will be 1. For salaries in the range $50,000-$74,999, the controlling expression's value will be 2. for salaries in the range $75,000-$99,999, the controlling expression's value will be 3. For all other salaries, use the default case.


d) After the switch statement you inserted in Step c, insert a statement that calculates the person's income tax by multiplying the salary and taxRate values, then stores the result in the double variable incomeTax. after the statement that creates the DecimalFormat called dollars, insert a statement that formats the value of incomeTax and displays the formatted value in incomeTaxJTextField.


Also, this should be in a specific format as seen with the tutorial given in chapter 11. Please go line by line so it's easier for me to comprehend...example: line 114: ......... Thanks!

Explanation / Answer

switch(salary/25000)

{

case 0: taxRate = 2; break;

case 1:taxRate = 5; break;

case 2:taxRate = 10; break;

case 3:taxRate = 15; break;

dafault:taxRate = 20;

}

incomeTax = ((double)(taxRate*salary))/100;

incomeTaxJTextField.setText(""+incomeTax+"$");

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote