This is my second programming class so please bear with me. I have an assignment that requires me to create an RPN Calculator with functions. It's my first time learning about functions so I'm still confused.
My question is: The operator (+, -, *, /, etc.) when entered by the user should do what's asked. But I was thinking of using "If statement" for each operator. I tried "if (oper == '+') but it wouldn't work. Second time around, I tried as seen underneath. Fail! Illegal start of expression. Frustrating! Does anyone have any ideas of how I could start? And the worse part is I have no idea of how to put the operators in functions. Any help would be appreciated! Thank you.
String oper;
double x, y;
double sum;
System.out.print("X: ");
x = keyboard.nextDouble();
System.out.print("Y: ");
y = keyboard.nextDouble();
System.out.print("Op: ");
oper = keyboard.nextLine();
if (oper.equals(+))
System.out.print("add");
System.out.println();