I am writing a program that needs me to input the assessed value of a home and then the output should be stored in a file. The program deals with property tax. I'm getting the error
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:840)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextDouble(Scanner.java:2387)
at Problem4.main(Problem4.java:33)
Here is my full code
// Stefan Springhetti // Problem4 // 2/1/2001 import java.io.*; import java.util.*; import javax.swing.*; public class Problem4 { public static void main(String[] args) throws FileNotFoundException { String inputStr; double assessedValue; double taxableAmount; double taxRate; double propertyTax; taxableAmount = .92 * assessedValue; taxRate = 1.05; propertyTax = 1.05 * 92; Scanner inFile = new Scanner(new FileReader("tax.dat")); PrintWriter outFile = new PrintWriter("output.dat"); inputStr = JOptionPane.showInputDialog ("Enter the assessed value"); assessedValue = Double.parseDouble(inputStr); outFile.printf("Assesed Value: $" + String.format("%.2f", assessedValue) + "\n" + "Taxable Amount: $" + String.format("%.2f", taxableAmount)+ "\n" + "Tax Rate: $" + String.format("%.2f", taxRate) + "\n" + "Property Tax: $" + String.format("%.2f", propertyTax)); outFile.close(); } }