I am compiling a tax program and I have this compiler problem that I cant figure out . Can some one please help me. java:28: possible loss of precision
found : double
required: int
StateTaxDue = (0.03 * incomeValue - (600 * dependentsValue));
Heres my program:
import java.io.*;
import javax.swing.JOptionPane;
public class StateTax
{
public static void main(String[] args) throws IOException
{
BufferedReader inData;
inData = new BufferedReader(new InputStreamReader(System.in));
//declaring Variables
String income, dependents;
int StateTaxDue;
int incomeValue = Integer.parseInt(income);
int dependentsValue = Integer.parseInt(dependents);
//user input
System.out.println("State Tax Computation");
income = JOptionPane.showInputDialog(null, "Taxpayers Income:");
dependents = JOptionPane.showInputDialog(null, "Number Of Dependents:");
//Conversions
StateTaxDue = (0.03 * incomeValue - (600 * dependentsValue));
//output
JOptionPane.showMessageDialog(null, "State Tax Due:" + StateTaxDue);
System.exit(0);
}
}


Reply With Quote


Bookmarks