Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

PagePage numberof 10. Starting State: ◦ Increment input string's index value ◦ If is operator, next state is 1 ◦ If is digit, next state is 2 ◦ If is space, next state is 4 ◦ If is end of string, next

PagePage numberof 10. Starting State:◦ Increment input string's index value◦ If is operator, next state is 1◦ If is digit, next state is 2◦ If is space, next state is 4◦ If is end of string, next state is 5◦ If anything else, next state is 61. Found operator:◦ Pop 2nd number off stack◦ Pop 1st number off stack◦ Perform operation◦ Push result on stack◦ Next state is 0Note: Watch popping empty stack and division by zero2. Found digit:◦ Copy digit to temporary string◦ increment both the temporary and input string index values◦ If character in input string is a digit or decimal point next state is 2◦ otherwise next state 33. Found end of number:◦ append \0 on temporary array◦ convert and assign to variable◦ push number on stack◦ reset temp index to 0◦ decrease input index by 1◦ next state is 04. Found space:◦ next state is 05. Found end of input string:◦ pop result◦ return answerNote: Watch for leftovers on stack6. Found garbage◦ display error message◦ exit from programData StructuresRPN Evaluator - Testcase1 2 + Solution: 33 4 - Solution: -15 6 / Solution: 0.837 8 * Solution: 562 3 + 4 5 * * Solution: 1002.5 0.5 * Solution: 1.250 5 / Solution: 05 0 / Solution: Error! Division by 01.2345 6.7890 * Solution: 8.382 3 + 5 / 7 3 + 10 / + 2 / Solution: 1 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question