Peter wants to produce a program that adds or multiplies two numbers but he has made a mistake:
First he entered the numbers, and then the symbol, for example:
2 3 +
Can you help him figure out the answer?
Task:
Download the TXT file below and copy and paste the starter program for your preferred language.
Peter's program works when adding but not when multiplying.
Can you fix it so it handles not only the + operator but also the * operator?
Starter Code:
postfix-starter-code.txt
Input Format:
One line of input with three strings separated by a space
Output Format:
An integer
Example Input:
2 3 +
Example Output:
5
Note: For Java (and similar) programs the grader expects the name of the main class to be: postfix
When you have finished – return to the tutorial by closing this window or tab.