Hi, I'm trying to write a java program that will read in the scanner input from a user and outputs an postfix expression and answer so if you typed in: A = 5 B = 7 $PART2 AB+
the output would be AB+ = 12
I'm having trouble with the scanner input I can make it so a user can enter a letter and a number, but I'm having trouble trying to make the program shift so when the user enters $PART2 it will then begin to read in the post fix expressions.
If anyone could help I would greatly appreciate it.
public class PostEval
static public void main(String args)
Scanner scanner = new Scanner(System.in);
Stack<String> postFix = new Stack<String>();
String part2 = "$PART2";
System.out.println("Input Letter and Number it equals: ");
String letter = scanner.next();
int number = scanner.nextInt();
System.out.println("You Inputted:"+ letter+ equals+ number);
if(letter == "$PART2")
String postfix = scanner.nextLine();