Question: As shown in the textbook p219 Programming Problems #6, implement a class of infix calculators. Consider a simple infix expression that consist of single digit

 As shown in the textbook p219 Programming Problems #6, implement a

As shown in the textbook p219 Programming Problems #6, implement a class of infix calculators. Consider a simple infix expression that consist of single digit operands: the operators +, -* and/; and parentheses. Assume that unary operators are illegal and that the expression contains no embedded spaces. Design and implement a class of infix calculators. Use the algorithms given in the chapter 6 to evaluate infix expressions as entered into the calculator. You must first convert the infix expression to postfix form and then evaluate the resulting postfix expression. 6. Section 6.1.1 described an algorithm that reads a string of characters, correcting mistakes along the way. a. For the following input line, trace the execution of the algorithm and show the contents of the stack at each step: abc-dec-t-fgh b. The nature of the stack-based algorithm makes it simple to display the string in reverse order, but somewhat harder to display it in its correct order. Write a pseudocode algorithm that displays the string in its correct forward order. c. Implement the read-and-correct algorithm as a Ch function, but make the stack local to the function instead of an argument. Let the function construct a string that contains the corrected input characters in forward order, and return it. 6.1.1 Developing an ADT During the Design of a Solution When you type a line of text on a keyboard, you are likely to make mistakes. If you use the Back- space key to correct these mistakes, each backspace erases the previous character entered. Con- secutive backspaces are applied in sequence and so erase several characters. For instance, if you type the line abccdddet+-+-eg-fg where -- represents the backspace character, the corrected input would be abcdefg How can a program read the original line and get the correct input? In designing a solution to this problem, you eventually must decide how to store the input line. In accordance with the ADT approach, you should postpone this decision until you have a better idea of what operations you will need to perform on the data

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!