Hello,
I am writing a simple program for my Java class and I keep getting this annoying error that after reading the code over and over again, I just can't see where the error is originating from. Anything obvious sticking out?
Here is the error:
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at Exercise6.main(Exercise6.java:28)
Here is my code:
import java.io.Console;
public class Exercise6
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
double Employeename;
double Grosspay;
import java.util.*;
public class Exercise6
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
double Employeename;
double Grosspay;
int netpay;
double Federalincometax;
double statetax;
double socialsecuritytax;
double medicaremedicaidtax;
double pensionplan;
double healthinsurance;
System.out.print("Enter Gross amount: ");
Grosspay = console.nextDouble();
System.out.println();
System.out.print("Enter Employee Name: ");
Employeename = console.nextDouble();
System.out.println();
netpay = (int) (Grosspay * 0.15 * 0.035 * 0.0575 * 0.0275 * 0.05 - 75.00);
Federalincometax = netpay * 0.15;
statetax = netpay * 0.035;
socialsecuritytax = netpay * 0.0575;
medicaremedicaidtax = netpay * 0.0275;
pensionplan = netpay * 0.05;
healthinsurance = netpay - 75.00;