lundi 2 mars 2015

I am writing a code to calculate a federal tax refund. Can someone tell me what's wrong with this code?



I am trying to write a code to calculate a simple tax refund for single filers who make under $9,075.00 (just the first tax bracket) There are a few user inputs, and the final should calculate the tax. I am not sure why, but on the second question I get an error. I am a beginner to writing code. HELP!



package projectfinal;

import java.util.Scanner;

public class ProjectFinal {

public static void main(String[] args) {
// TODO code application logic here
Scanner s = new Scanner(System.in);
double Status, Dependency, Income, FedWithheld;
int userChoice;

System.out.print("Enter 1 if married or 2 if single with NO dependents:");
userChoice = s.nextInt();
if(userChoice == 1)
{
System.out.print("User is not eligible to use program");
}
else if(userChoice == 2)
{
System.out.print("Enter 3 if will claim yourself, or 4 if you can be claimed as a dependent on someone elses return:");
Dependency = s.nextDouble();
if(userChoice == 3)
{
System.out.print("User is not eligible to use program");
}
else if(userChoice == 4)
System.out.print("Enter the amount in Box 1 of your W2");
Income = s.nextDouble();
if(userChoice > 9075)
{
System.out.print("User is not eligible to use program");
}
else if(userChoice < 9075)
System.out.print("Enter the amount in Box 2 of your W2:");
FedWithheld = s.nextDouble();
System.out.print("Your Federal Tax Refund is " + FedWithheld-((Income - 6200)*.1);


}
}
}



Aucun commentaire:

Enregistrer un commentaire