Open LindaLiu1202 opened 1 year ago
Score: 2.8/3.0
Extra work done for completing FRQ 3, demonstrated knowledge with .substring, .get, and applying it into the Hacks. Also had additional notes and understanding. Points off for divide/power not working in API/Postman, but working in tester (which was a common problem with parsing/POST).
Hacks
Finish rpnToResult for Calculator
.pop() - returns the element present at the top of the stack and then removes it .peek() - returns the element at the top of the Stack else returns NULL if the Stack is empty During calculation algorithm will work through RPN, Left to Right. 1. go to first operator, 2. obtain to the amount of operands required for operator, 3. solve, 4. push result
Add unbalanced parenthesis check and in original FRQ, or other error checks. FYI, usually when structuring code with error checking it can greatly impact code structure.
FRQ isBalanced method (from an ArrayList)
difference between looping through every character in String and every item in ArrayList
for array
Build in Power of operator ^:2 ^ 1 = 2, 2 ^ 2 = 4, 2 ^ 3 = 83. Build an API to receive an expression and respond with a result. This is a good opportunity to respond with an error if you built in parenthesis or other error checking.
the order of precedence rules, aka PEMDAS (parenthesis, exponents, multiplication, division, addition, subtraction) need to be factored into order of computation
testing if power is precedent
tokensToReversePolishNotation ()
rpnToResult()
pow() - return the value of first argument raised to the power of the second argument return type of pow() method is double
Build an API to receive an expression and respond with a result.
Tester
Output
Testing using Postman Simple Math
Demonstrating Order of Precedence
multiplication have precedence over addition
Basic Skill building, do FRQ3. FYI, isBalanced could help in error corrections for Calculator.