Skip to content

Commit 6e4006c

Browse files
author
AmiyahJo
committed
thought proccess in comments
1 parent 056f84a commit 6e4006c

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lesson_06/expression/src/expression_calculator.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@ export class ExpressionCalculator {
22
/** Returns the calculation of ((a + b) * c) / d^e */
33
calculate(a: number, b: number, c: number, d: number, e: number): number {
44
// Implement your code here to return the correct value.
5-
function addHere(a:number,b:number){
6-
const add = a + b;
7-
};
85

9-
function multiplyHere(addHere:number, c: number){
10-
const multi = addHere * c;
11-
};
6+
//PEMDAS order -> expected : //((a + b) * c) / d^e
127

13-
function divideHere(d: number, e: number) {
14-
const divi = multiplyHere / d^e;
15-
};
16-
17-
//For this assignment, you will need to implement the functions and logic required to calculate a mathematical expression.
18-
// After implementing the add, divide, and multiply functions, you will combine these functions to compute the final result.
8+
// Caculate addition with an add function '(a + b)'
199

20-
return (addHere * multiplyHere) / divideHere;
10+
// caculate multiplication '(add * c)' and 'd^e' so d * (e times)
11+
12+
// caculate division with divide function which is different variables of the multiplication values '(add * c)' and 'd^e' so d * (e times)
13+
14+
return 0;
2115
}
2216

2317
pow(base: number, exponent: number): number {

0 commit comments

Comments
 (0)