Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code In python. [1p] Implement class MathematicalExpression that stores a mathematical expression in a text format. [2p] Implement support for the plus operator, where the
code In python.
[1p] Implement class MathematicalExpression that stores a mathematical expression in a text format. [2p] Implement support for the plus operator, where the first argument is always Mathematicalexpression instance and second argument can be either numeric (int, float) or also Mathematicalexpression instance. The result of the addition is a new MathematicalExpression instance. 2. [1p] Implement the equality operator - two Mathematicalexpression instances are equal if and only if the expressions are equal (not only the results). Spaces in the expressions do not matter. 3. [2p] Implement a class IntegerExpression that inherits from MathematicalExpression and which expression can only contain integer numbers (not floating point numbers, i.e. "3+3" not "3.3+3"). Ensure this by raising an appropriate exception. Try to reuse as much code from Mathematicalexpression as possible. Mathematicalexpression example: >> MathematicalExpression("2 +3")== Mathematicalexpression ("2+3") True TrueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started