Question: A menu driven program: 1- ask to enter an inorder arithmetic expression,the input should be fully parenthesized 2- display the infix order of the expression

A menu driven program:

1- ask to enter an inorder arithmetic expression,the input should be fully parenthesized

2- display the infix order of the expression

3- display the prefix order of the expression

4- evaluate the expression and display the answer (could be done by converting the infix expression into a postfix expression by using a stack)

details are shown in the picture below :

A menu driven program: 1- ask to enter an inorder arithmetic expression,the

Project Description: An Expression Tree Builder/Evaluator An arithmetic expression can be represented using a binary tree whose leaves are associated with variables or constants, and whose internal nodes are associated with one of the operators +, -, *, and . Each node has a value associated with it. write an implementation of the BExpTree class. You can use either array-based or linked-based implementation. The BiExpTree class has the following methods 1.BExpTree0: to construct an empty binary expression tree 2. CreateExp (exp) takes a fully parenthesized expression and builds a binary expression tree representation fort. You may assume that all operators are values (variables are not required). 3. prefix) displays the prefix form of the expression 4. infix0: displays the infix form of the expression stored in the 5. evalExp0: evaluates the arithmetic expression stored in the stored in the calling BiExpTree object calling BiExpTree object calling BiExpTree object and returns its value. gram: Write a menu-driven program to implement an expression tree builder and evaluator. The menu includes the following options 1. Input new arithmetic expression. The program w prompt the user to enter a fully parenthesized arithmetic expression. A binary expression tree corresponding to that expression is created. You may assume that only valid input is expected 2. Display prefix form of expression The programw invoke the prefix) method from the BExpTree class to display a prefix form of the expression. 3. Display infix form of expression. The program invoke the infix method from the BExpTree class to display an infix form of the expression. 4. Evaluate expression. The program wl call the EvalExprO method from the BExpTree class. 5. Exit

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!