Write a Java application that follows the formulas below cal
Write a Java application that follows the formulas below, calculates all the numbers step by step, and finally prints out the State tax one owes.
Federal taxable income = $80,000
Federal tax = Federal taxable income X Federal tax rate (which is 28%)
State tax base = Federal tax – State deductible (this deductible is $10,000)
State tax owed = State tax base X State tax rate (which is 15%
Solution
//Tested on eclipse
/*******************Tax.java***************/
public class Tax {
public static void main(String args[]) {
/* Variable declaration with initializing */
int federalTaxableIncome = 80000;
int federalTaxableRate = 28;
int stateDeductible = 10000;
int stateTaxRate = 15;
double stateTaxBase;
double stateTaxOwed;
/* calculating federalTax based on formula */
double federalTax = (federalTaxableIncome * federalTaxableRate) / 100;
/* calculating stateTaxBase based on formula */
stateTaxBase = federalTax - stateDeductible;
/* calculating stateTaxOwed based on formula */
stateTaxOwed = (stateTaxBase * stateTaxRate) / 100;
/* Printing stateTaxOwed value after calculation */
System.out.println(\"State tax owed is \" + stateTaxOwed);
}
}
/**************output************/
State tax owed is 1860.0
Thanks a lot
