Question
Java tax calculator This is my java statement public static void main(String[] args) { final double RATE1 = 0.15; final double RATE2 = 0.28; final
Java tax calculator
This is my java statement
public static void main(String[] args)
{
final double RATE1 = 0.15;
final double RATE2 = 0.28;
final double RATE3 = 0.31;
final double S1 = 21450.0;
final double S2 = 51900.0;
final double M1 = 35800.0;
final double M2 = 86500.0;
char S = 0;
char status = S;
double income = 21450;
int Dependents = 0;
double Taxowed = 0;
Scanner in = new Scanner(System.in);
System.out.print("Filling status"+status);
System.out.print(" Annual Gross Income");
System.out.print(" Dependents: "+Dependents);
System.out.print(" Tax Owed");
if ( status == 'S' )
{
if ( income
Taxowed = RATE1 * income;
else if ( income
Taxowed = RATE1 * S1
+ RATE2 * (income - S1);
else
Taxowed = RATE1 * S1
+ RATE2 * (S2 - S1)
+ RATE3 * (income - S2);
}
else
{
if ( income
Taxowed = RATE1 * income;
else if ( income
Taxowed = RATE1 * M1
+ RATE2 * (income - M1);
else
Taxowed = RATE1 * M1
+ RATE2 * (M2 - M1)
+ RATE3 * (income - M2);
}
}
}
Output should follow this format
I don't know how to make code about dependents and tax owed when dependents present.
This is explanation about this problem
Thank you.
Test Case 1: 21,450 single Enter Filing status. Type single or married: single Enter number of dependents: 0 Enter annual income: 2145 Filing Status single Annual Gross Income Depndents Tax Owed 21,450.00 2, 467.50 Test Case 2: 35,800 married Enter Filing status. Type single or married: married Enter number of dependents: 0 Enter your income: 35800 Enter spouse' s income: 0 Filing Status married Annual Gross Income Depndents Tax Owed 35,800.00 3,870.00 Test Case 3: Adjusted income 0 single Enter Filing status. Type single or married: single Enter number of dependents: 3 Enter annual income: 20000 Filing Status single Annual Gross Income Depndents Tax Owed 20,000.00 3 0.00 Test Case 4: Adjusted income > 0 single Enter Filing status. Type single or married: single Enter number of dependents: 2 Enter annual income: 20000 Filing Status single Annual Gross Income Depndents Tax Owed 20,000.00 750.00 Test Case 5: Adjusted incomeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started