I am attempting to create a calculator using Java. I know that I will need to create a parser to convert the user's data from a string to doubles and a character.
I was wondering if, by creating the parser, the data that the user enters (for example 7 / 5 ) would be already separated or if I would need to separate the data somehow.
I was also wondering how the operator would effect the parser and if there was a way to retrieve that separately. I had attempted to use input.next(); to retrieve the operand but I think because I am using the parser, it may not work.
Here is my code:
String rawUserInt;
String method;
double answer;
Scanner input = new Scanner(System.in);
System.out.println("Please input the equation you would like to solve");
double userInt1 = Double.parseDouble(rawUserInt);
method = input.next();
double userInt2 = Double.parseDouble(rawUserInt);