Question: (Java) If-Else (Tax Calculator) Complete the following code in order to calculate the corresponding tax due for a certain taxpayer considering the following tax policy.
(Java) If-Else (Tax Calculator)
Complete the following code in order to calculate the corresponding tax due for a certain taxpayer considering the following tax policy. Depending on marital status and their annual income different rates are applied. If the taxpayers are single, their income up to $32,000 is taxed at a 10%; in case they have an annual income above $32,000, the additional income is taxed with a 25% rate. If the taxpayers are married, their income up to $64,000 is taxed at a 10%; in case they have an annual income above $64,000, the additional income is taxed with a 25% rate. Assume that the initial value of the variable maritalStatus is already set to a String value (which only can have the values "single" or "married") and the initial value of the variable annualIncome is set to an integer value. E.g. 1: if maritalStatus="single", annualIncome=30000, then taxDue=3000.0. E.g. 2: if maritalStatus="married", annualIncome=70500, then taxDue=8025.0. E.g. 3: if maritalStatus="single", annualIncome=40090, then taxDue=5222.5.
1
// TODO: Write your code here
2
double taxDue;
3
4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
