Question: A2B2 file: from Stack import Stack class PostFixAE: # * Assume valid PAE in inList def __init__(self, inList): # constructor self.inPAEList = inList # the

 A2B2 file: from Stack import Stack class PostFixAE: # * Assumevalid PAE in inList def __init__(self, inList): # constructor self.inPAEList = inList

A2B2 file:

from Stack import Stack class PostFixAE: # * Assume valid PAE in inList def __init__(self, inList): # constructor self.inPAEList = inList # the input List as PAE ###################### STUDNET's WORK ###################### # simple comment HERE # * Assume valid input parameters def binaryOpn(self, num1, oprSym, num2): # return result of binary operation pass # TO BE DONE # simple comment HERE # * Assume valid PAE in self.inPAEList def evaluatePAE(self): # return result of PAE pass # TO BE DONE, based on the algorithm in lecture note #################### END of STUDNET's WORK ######################

MA2B2 file:

from A2B2 import PostFixAE def main(): print("=== A2B2, PAE using Stack, by   === ") myPAE = PostFixAE([]) print(f" DIRECT TEST 1: myPAE.binaryOpn(8,'add',2): {myPAE.binaryOpn(8,'add',2)}") print(f" DIRECT TEST 2: myPAE.binaryOpn(8,'mul',2): {myPAE.binaryOpn(8,'mul',2)}") print(f" DIRECT TEST 3: myPAE.binaryOpn(8,'sub',2): {myPAE.binaryOpn(8,'sub',2)}") print(" - 1. ---") myPAE = PostFixAE([7, 8, 2, 'mul', 'add']) print(f" RESULT of {myPAE.inPAEList}: {myPAE.evaluatePAE()}") myPAE = PostFixAE([33, 7, 'add', 25, 22, 'sub', 'mul']) print(" - 2. ---") print(f" RESULT of {myPAE.inPAEList}: {myPAE.evaluatePAE()}") # below, avoid execution if import only if __name__ == "__main__": main() 

pls follow the request, and make sure the output is the same. Thank you!

Develop a Stack-Based Application of evaluating Postfix Arithmetic Expressions (PAE), with the given Python file A2B2.py. Suppose we are defining our OWN binary arithmetic operators with string symbols below: - Write a Python program to evaluate postfix Arithmetic Expressions, with the given Stack: - Define a Python PostFixAE class in file A2B2.py, with given Stack class (in file Stack.py), to evaluate Postfix Arithmetic Expression (PAE) using the algorithm in our lecture note (slide 21): Examples of valid PAE (Postfix Arithmetic Expression) stored in a Python 1 ist as input PAE Input Python List [7,2,3,mu],, sub'] as input PAE 723*- Input Python List [2,3, add ,9,5,sub,mul] as input PAE 23+95 Operations (methods of the class) to be implemented by Students: * ONLY access the interface (methods) of the given Stack data type. * DO NOT access the internal fields of the given stack, such as pList, top and capacity. At least one line of simple comment for each extra operation required Sample console display output of executing the main testing program MA2B2. py 8. add. 2=10 DIRECT TEST 1: myPAE. binaryOpn (8, ' add ,2):10 8.mul. 2=16 DIRECT TEST 2: myPAE.binaryOpn (8,mul,2):16 8. sub. 2=6 DIRECT TEST 3: myPAE.binaryOpn (8, 'sub', 2):6 1 8.mul. 2=16 7. add. 16=23 RESULT of [7,8,2, 'mul', 'add' ]:23 - 2..- 33. add. 7=40 25. sub. 22=3 40. mul.3=120 RESULT of [33,7, 'add', 25, 22, 'sub', 'mul']: 120

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!