Ganesh Thanga wrote:I went explaining that we could create classes like Operators,Operands and Expression and saying that the class Expression would be having Operators and Operands and child expression.
If you want to create a program that can parse and evaluate expressions, that sounds like a good start. Think about what kinds of things there can be in an expression: operators, numbers, variables, subexpressions etc. Now think about how these things fit together. What exactly does an expression consist of? How do operators connect parts of an expression?
To give you an idea of what you could do, look for the description of "expression trees" on
this page. Once you've parsed the expression into an expression tree, you can let your program do useful things with it. Here is
another example.