-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentation.txt
More file actions
8 lines (8 loc) · 2.29 KB
/
documentation.txt
File metadata and controls
8 lines (8 loc) · 2.29 KB
1
2
3
4
5
6
7
8
Project Documentation
Author: Oscar Cisneros
Part A: Written Documentation
1. The program objective is to create a command line interface arithmetic calculator such that an arithmetic expression can be input through the CL and the value of the evaluation of the expression is returned(or a syntax error for invalid expressions).
2. This program implements Binary Tree by converting string literals representing expressions into Binary Expression Trees- Binary Trees whose leaf nodes are operands and internal nodes are operators. These expressions trees are then evaluated using preorder traversal which builds matching function calls on the operands into strings of nested function calls that ultimately evaluate the expression.
3. The calculations are performed by the evaluate() method of the expression tree object. This method first performs integer-ization of the operands by recording and then multiplying to the highest number of decimal places in order to avoid the pitfalls of floating point subtraction(mainly the .3-.2 problem). It then calls the appropriate method on the numbers by finding the method in a math dictionary whose keys are string representations of the operators(“*”, “/”, etc.).Finally, it multiplies by the highest number of decimals recorded earlier and returns the value, rounded to up to 8 significant figures, depending on the character length of the number and its magnitude.
4. The program cannot properly handle large numbers due to its reliance on floating point numbers as opposed to long int(which also has its limitations on number size) or long long int on a more exotic system than a standard macbook. More limited is its presentation and accessibility which are both limited by its existence as a CLI program and not a GUI. The average person will probably either not want to or/and be unwilling to interact with it in light of all of the impressively designed alternatives.
5. An improvement that could easily improve the overall usefulness of the program would be to add a GUI so that it is more user friendly and accessible to a greater audience. Further, it could also perform more operations, such as evaluate trigonometric functions and logarithms. This would make it more useful from an academic perspective, which is precisely the target audience for such an application.