Question: Write 3 individual programs that use a stack to work with infix / postfix equations and equation verification. Verify equations based on balanced parentheses, brackets,

Write 3 individual programs that use a stack to work with infix / postfix equations and equation verification.

  1. Verify equations based on balanced parentheses, brackets, and curly braces. (50)
    1. Examples of good equations:
      1. (a + b)/c
      2. (2-1)+(2+3)
      3. {[(a + b) * a]/b} + 1
      4. a + (b /c)
    2. Examples of bad equations:
      1. (a + b/c
      2. ()((())
      3. {if you eat a lot}/(you will belch)
  2. Evaluate post fix equations.(100)
    1. Example:
      1. 1 2 + 3 * => results in 6
      2. 2 3 3 + * => results in 12
  3. Infix to PostFix (100)
    1. Example:
      1. (a + b)*c => ab+c*
      2. a + b * c => abc*+

4. Take all of the above programs and combine them tin one separate program.

Requirements:

1. Must be in c++;

2. No built in types. must make own functions and classes.

3. Make it as simple as possible.

Write a snippet of code into the main program that combines all 3 programs to read in the test values from a text file.

Test Material:

1. parentheses tests

x = ((1 + 2)*3

x = (1 + 2))*3

y = (z * j)/(b * 8)^2

2. postfix equation solving

7 3 + 9 *

5 2 + 1 9 * *

8 9 * 3 5 + -

2 + 8 4 /

3. infix to postfix conversion

(8 + 4) * 9

(6 + 3) * (2 * 8)

(9 * 8) (5 + 3)

3 + (9 / 3)

4. Parentheses check, infix to postfix conversion, postfix evaluation

(8 + 4) * 9

(6 + 3) * (2 * 8)

(9 * 8) (5 + 3)

3 + (9 / 3)

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!