Create a stack to convert prefix expressions directly to postfix expressions. You may not use recursion as
Fantastic news! We've Found the answer you've been seeking!
Question:
Compose a program that accepts a prefix expression containing single letter operands and the operators +, -, *, /, and $ (representing exponentiation). Output the corresponding postfix epression.For example, if your input is *AB then output should be AB*. Output of BA* is considered incorrect.In your analysis, be sure to discuss the implementation you choose and why, why a stack makes sense. Consider a recursive solution (you should not implement recursion) and compare it to your iterative solution. Is one better than the other? Why? Tell us what you learned and what you would do differently. Don't forget to do reasonable error checking and try to make your error messages specific and helpful.You may not use library functions. Compose your own code and, specifically, you must write the stack code. Be sure to include the stack source code in your submission. You must read and write from named files.
The required input is provided in a separate text file.
In processing the input, you should expect to read line by line and withing a line, character by
character,. This will allow you to parse the expression as you read it.
Required Input.txt
-+ABC
-A+BC
$+-ABC+D-EF
-*A$B+C-DE*EF
**A+BC+C-BA
/A+BC +C*BA
*-*-ABC+BA
/+/A-BC-BA
*$A+BC+C-BA
//A+B0-C+BA
*$A^BC+C-BA
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date: