import java.util.*; //Include the needed package
public class IncomeTax //Class
{
public static void main(String[] args)
{
Scanner scInput = new Scanner(System.in); //Create new
instance
System.out.println("\nEnter the filing status"); //Prompt for
input
System.out.println("\0 for filling as single. ");
System.out.println("\1 for filling as married jointly. ");
System.out.println("\2 for filling as married separately. ");
System.out.println("\3 for filling as head of household. ");
int filingStatus = scInput.nextInt();
System.out.println("Enter the taxable income:");
double ti = scInput.nextDouble();
double it = 00.00;
if(filingStatus==0)
{
if (ti<=8350)
it=ti*0.10;
else if (ti <= 82250)
it=8350*0.10+(33950-8350)*0.15+(ti-33950)*0.25;
else if (ti<=171550)
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(ti-82250)*0.28;
else if(ti<372950)
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(ti-171550)*0.33;
else
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(372950-171550)*0.33+(ti-372950)*0.35;
}
else if (filingStatus==1) //Check condition for married filling
jointly
{
if (ti<=16700)
it=ti*0.10;
else if (ti<=67900)
it = 16700*0.10+(ti-16700)*0.15;
else if (ti<=137050)
it=16700*0.10+(67900-16700)*0.15+(ti-67900)*0.25;
else if (ti<=208850)
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(ti-137050)*0.28;
else if (ti<=372950)
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(208850-137050)*0.28+(ti-208850)*0.33;
else
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(208850-137050)*0.28+(372950-208850)*0.33+(ti-372950)*0.35;
}
else if (filingStatus==2) //Checking condition for married filing
seperately
{
if (ti<=8350)
it=ti*0.10;
else if (ti<=33950)
it=8350*0.10+(ti-8350)*0.15;
else if (ti<=68525)
it=8350*0.10+(33950-8350)*0.15+(ti-33950)*0.25;
else if (ti<=104425)
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(ti-68525)*0.28;
else if (ti<=186475)
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(104425-68525)*0.28+(ti-104425)*0.33;
else
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(104425-68525)*0.28+(186475-171550)*0.33+(ti-372950)*0.35;
}
else if (filingStatus==3) //Checking condition for head of
household
{
if (ti<=11950)
it= ti*0.10;
else if (ti<=45500)
it=11950*0.10+(ti-11950)*0.15;
else if (ti<=117450)
it=11950*0.10+(45500-11950)*0.15+(ti-45500)*0.25;
else if (ti<=171550)
it=11950*0.10+(45500-11950)*0.15+(117450-45500)*0.25+(ti-117450)*0.28;
else if (ti<=372950)
it=11950*0.10+(45500-11950)*0.15+(117450-45500)*0.25+(171550-117450)*0.28+(ti-171550)*0.33;
else
it=11950*0.10+(45500-11950)*0.15+(117450-45500)*0.25+(171550-117450)*0.28+(372950-171550)*0.33+(ti-372950)*0.35;
}
else
{
System.out.println("Invalid filing status");
}
System.out.println("Tax is : " + (int)(it * 100)/100.);
}
}
I have done the code
when I test run the code the sample one was a success and same as the picture but sample 2,3,4 was not same as the picture
pls find the error in the code and reply asap
//Modified code
solution
//output
//copyable code
import java.util.*; //Include the needed package
public class IncomeTax //Class
{
public static void main(String[] args)
{
Scanner scInput = new Scanner(System.in); //Create new instance
//Prompt for input
System.out.println("\nEnter the filing status");
System.out.println("\n 0 for filing as single.");
System.out.println("\n 1 for filing as married jointly.");
System.out.println("\n 2 for filing as married separately.");
System.out.println("\n 3 for filing as head of household.");
int filingStatus = scInput.nextInt();
System.out.println("Enter the itable income:");
double ti = scInput.nextDouble();
double it = 00.00;
if(filingStatus==0)
{
if (ti<=8350)
it=ti*0.10;
else if (ti <= 33950)
it = 8350*0.10+(ti-8350)*0.15;
else if (ti <= 82250)
it=8350*0.10+(33950-8350)*0.15+(ti-33950)*0.25;
else if (ti<=171550)
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(ti-82250)*0.28;
else if(ti<=372950)
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(ti-171550)*0.33;
else
it=8350*0.10+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(372950-171550)*0.33+(ti-372950)*0.35;
}
else if (filingStatus==1) //Check condition for married filling jointly
{
if (ti<=16700)
it=ti*0.10;
else if (ti<=67900)
it = 16700*0.10+(ti-16700)*0.15;
else if (ti<=137050)
it=16700*0.10+(67900-16700)*0.15+(ti-67900)*0.25;
else if (ti<=208850)
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(ti-137050)*0.28;
else if (ti<=372950)
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(208850-137050)*0.28+(ti-208850)*0.33;
else
it=16700*0.10+(67900-16700)*0.15+(137050-67900)*0.25+(208850-137050)*0.28+(372950-208850)*0.33+(ti-372950)*0.35;
}
else if (filingStatus==2) //Checking condition for married filing seperately
{
if (ti<=8350)
it=ti*0.10;
else if (ti<=33950)
it=8350*0.10+(ti-8350)*0.15;
else if (ti<=68525)
it=8350*0.10+(33950-8350)*0.15+(ti-33950)*0.25;
else if (ti<=104425)
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(ti-68525)*0.28;
else if (ti<=186475)
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(104425-68525)*0.28+(ti-104425)*0.33;
else
it=8350*0.10+(33950-8350)*0.15+(68525-33950)*0.25+(104425-68525)*0.28+(186475-171550)*0.33+(ti-372950)*0.35;
}
else if (filingStatus == 3) {
if (ti>=0 & ti <= 11950)
it = ti * 0.10;
else if (ti <= 45500)
it = 11950*0.10 + (ti - 11950)*0.15;
else if (ti <= 117450)
it = 11950*0.10 + (45500 - 11950)*0.15 +(ti - 45500) * 0.25;
else if (ti <= 190200)
it = 11950*0.10 + (45500 - 11950)*0.15 +(117450 - 45500)*0.25 + (ti - 117450)*0.28;
else if (ti <= 372950)
it = 11950*0.10 + (45500 - 11950)*0.15 +(117450 - 45500)*0.25 + (190200 - 117450)*0.28 +(ti - 190200) * 0.33;
else
it = 11950*0.10 + (45500 - 11950)*0.15 +(117450 - 45500)*0.25 + (190200 - 117450)*0.28 +(372950 - 190200)*0.33 + (ti - 372950)*0.35;
}
else
{
System.out.println("Invalid filing status");
}
System.out.println("tax is : " + (int)(it * 100)/100.0);
}
}
import java.util.*; //Include the needed package public class IncomeTax //Class { public static void main(String[] arg...
I have already done the source code
I just need help in the analysis part and design part
asap
Thank you
File Edit View Windew Help ⑦ A Sign In Home Tools IT109N Assigmenx d share By completing this assignment, students should be able to: Assign expressions to variables Perfarm arithrietic calculations using Java Implement console user input/output in their programs . Use If clse statements to control the flow of logic in a program Computing Tax The United States...
Cant figure out how to fix error Code- import java.io.File; import java.io.IOException; import java.util.*; public class Program8 { public static void main(String[] args)throws IOException{ File prg8 = new File("program8.txt"); Scanner reader = new Scanner(prg8); String cName = ""; int cID = 0; double bill = 0.0; String email = ""; double nExempt = 0.0; String tExempt = ""; int x = 0; int j = 1; while(reader.hasNextInt()) { x = reader.nextInt();} Customers c1 [] = new Customers [x]; for (int...