Java on Eclipse calculator issue [message #1740253] |
Wed, 10 August 2016 18:41 |
Eclipse User |
|
|
|
I'm having this is problem on eclipse, after i make the program run it shows this:
Enter first number:
3.3
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 BuildingaBasicCalculator.main(BuildingaBasicCalculator.java:9)
Here is the program of the calculator:
import java.util.Scanner;
class BuildingaBasicCalculator {
public static void main (String args[]){
Scanner sam = new Scanner(System.in);
double fnum, snum, answer;
System.out.println("Enter first number: ");
fnum = sam.nextDouble();
System.out.println("Enter second number: ");
snum = sam.nextDouble();
answer = fnum + snum;
System.out.println(answer);
sam.close();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.07917 seconds