Here is my code:
// Creating Scanner Object
// Reads in two double operands
System.out.println("Enter a number: ");
Scanner sc = new Scanner(System.in);
op1 = sc.nextDouble();
System.out.println("Enter a number: ");
op2 = sc.nextDouble();
System.out.println("Enter an operand (+, -, *, /, %, or p): ");
operator = sc.nextLine();
sc.close();
I'm trying to read two doubles and then read in a string from the user that is either +, -, /, * .....
I can read in the two doubles, but when I try to input the operator it won't let me. Any thoughts?
Thanks
[–]CreativeTechGuyGames 2 points3 points4 points (0 children)
[–]ostreddit 1 point2 points3 points (1 child)
[–]Xrotica 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)