File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,26 @@ export class ExpressionCalculator {
6
6
//PEMDAS order -> expected : //((a + b) * c) / d^e
7
7
8
8
// Caculate addition with an add function '(a + b)'
9
- function Add ( a , b ) {
10
- let addition = a + b ;
11
- } ;
9
+ const originalSum = you . add ( a , b ) ;
12
10
// caculate multiplication '(add * c)' and 'd^e' so d * (e times)
13
-
11
+ const multiply = you . multiply ( originalSum , c )
14
12
// caculate division with divide function which is different variables of the multiplication values '(add * c)' and 'd^e' so d * (e times)
15
-
13
+ const lastOne = you . divide ( multiply , d ^ e )
16
14
return 0 ;
17
15
}
18
16
17
+ function add ( a : number , b : number ) {
18
+ return a + b ;
19
+ }
20
+
21
+ function multiply ( originalSum : number , c : number ) {
22
+ return originalSum * c ;
23
+ }
24
+
25
+ function divide ( a : number , b : number ) {
26
+ return a / b ;
27
+ }
28
+
19
29
pow ( base : number , exponent : number ) : number {
20
30
return Math . pow ( base , exponent ) ;
21
31
}
You can’t perform that action at this time.
0 commit comments