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

Write a program that computes taxes due for a person with a filing status of sin

ID: 3537260 • Letter: W

Question

Write a program that computes taxes due for a person with a filing status of single. Include deductions, exemptions, and credits. Apply the tax rate to the income after applying the deductions and exemptions. Then subtract credits from the tax due to get the final tax amount due. Expected output sample is provided below. Name your class

TaxReturn.

Income: $85,500

Deductions: $23,753

Exemptions: $15,200


Taxable Income: $46,547


Tax: $ 7,667

Less Credits $ 5,000


Tax Due: $ 2,667





Use the following website to check your answers: http://www.moneychimp.com/features/tax_brackets.htm

Explanation / Answer

public class TaxReturn {

public int income;

public int deductions;

public int exemptions;

public int credits;

public final int EXEMPTION_MULTIPLIER = 3800;

public final double[] taxIncomeRange = {0, 8925, 36250, 87850, 183250, 398350, 400000};

public final double[] taxBracket = {10, 15, 25, 28, 33, 35, 39.6};

//Constructor of TaxReturn class with income, deductions, exemptions and credits as input parameters

public TaxReturn(int income, int deductions, int exemptions, int credits){

this.income = income;

this.deductions = deductions;

this.exemptions = exemptions;

this.credits = credits;

}

//Function to calculate exemption amount

// Exemption = number of exemptions * 3800

public int getExemptionAmount(){

return this.exemptions * this.EXEMPTION_MULTIPLIER;

}

//Function to calculate the taxable income

//Taxable income = Total income - deductions - exemption

public int getTaxableIncome(){

int exemptionAmount = getExemptionAmount();

int taxableIncome = this.income - this.deductions - exemptionAmount;

return taxableIncome;

}

//Function to calculate the tax

//Based on table

public double calculateTax(){

double tax = 0;

int taxableIncome = getTaxableIncome();

int count = 0;

while(count < taxIncomeRange.length)

{

if(taxableIncome<taxIncomeRange[count])

break;

count++;

}

int i = 0;

for(i=0; i<count-1; i++){

tax = tax + (taxIncomeRange[i+1]-taxIncomeRange[i])*taxBracket[i]/100;

}

tax = tax + (taxableIncome-taxIncomeRange[i])*taxBracket[i]/100;

return tax;

}

//Function to calculate the tax due.

//Tax due = Tax-credits

public double calculateTaxDue(){

return calculateTax()-credits;

}

//Function to display the tax returns

public void displayTaxReturns(){

System.out.println("Income: "+income);

System.out.println("Deductions: "+deductions);

System.out.println("Exemptions: "+getExemptionAmount());

System.out.println("Taxable Income: "+getTaxableIncome());

System.out.println("Tax: "+calculateTax());

System.out.println("Less Credits: $"+credits);

System.out.println("Tax Due: "+calculateTaxDue());

}


public static void main(String args[]){

TaxReturn t = new TaxReturn(85500, 23753, 4, 5000);

t.displayTaxReturns();

}

}


/*Output

Income: 85500

Deductions: 23753

Exemptions: 15200

Taxable Income: 46547

Tax: 7565.5

Less Credits: $5000

Tax Due: 2565.5

*/

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