standard output
hey y'all i need help with the following program that calculates property tax at 92% or $1.05 for every $100..
import java.io.*;
import java.util.*;
publicclass PropertyTax
{
publicstaticvoid main (String[] args)
throws FileNotFoundException
{
PrintWriter outFile =new PrintWriter("tax.txt");
String assValueString ="";
System.out.print("Enter Assessed Value: ");
double assValue = Double.parseDouble(assValueString);
double taxableamount = (assValue * .92);
double propertytax = (assValue - taxableamount);
outFile.printf("Assessed Value: " +"$" + assValue);
outFile.printf("Taxable Amount: " +"$" + taxableamount);
outFile.printf("Tax Rate for Each $100.00: " +"$" +"1.05");
outFile.printf("Property Tax:" +"$" + propertytax);
outFile.close();
}
}
i keep getting the error message:
NumberFormatException:
empty String (in sun.misc.FloatingDecimal)
any help would be greatly appreciated =]
Message was edited by:
nsfour
[1897 byte] By [
nsfoura] at [2007-11-27 2:55:24]

> yeah that was my main problem: i completely forgot
> how to store user input [without a dialog box] into a
> single variable.. such a simple thing
>
> ugh, hate to ask you again.. but what should i put
> there
From standard input I guess. So depending on your java version:
< 5 : use a [url=http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html]BufferedReader[/url] (that wraps an InputStreamReader for System.in), and its readLine method
>= 5 : use a [url=http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html]Scanner[/url] (which allows reading a double directly, btw)
okay so i used system.in, however, i've hit another snag..
Scanner console = new Scanner(System.in);
System.out.println("Enter Assessed Value:");
String assValue = console.next();
double taxableamount = (assValue * .92);
double propertytax = (assValue - taxableamount);
i get the error: operator * cannot be applied to java.lang.String,double
how can i multiply assValue by 92%?