The attached source code is a class - FormulaGenerator, which is a component that interprets and evaluate a string expression.
String Expression Interpreter:
This component interpret a string expression and return the result of the expression or error. The component works with +, -, *, / (Addition, Subtraction, Multiplication and Division) and with any level of parenthesis.
Example of valid expression: (1 + 6) * (20 / (5 + 5)) Also this component could be modified to work with literal expression (every literal can be load from database; could be useful for salary calculus)
Download the attached source code for more details.