I'm trying to make a calculator where it's possible to either take in a single number, or take in a calculation (f.ex 2+2). Is it even possible to take in a calculation with scanner, or do some of you know a agile way to make it though.
System.out.println("Write in a number or a calculation: ");
Scanner a = new Scanner(System.in);
String ab = a.nextLine();
Double abc = Double.valueOf(ab);
I hoped that this would work, but as it converts from string to double, it crashes as there is a char.. Someone got any good ideas?