Skip to content

Commit 3d1c364

Browse files
committed
feat: added calculate fuctions and helper functions
1 parent 73e5c18 commit 3d1c364

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lesson_06/expression/.env.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
HW_VERSION=your assigned version here
1+
HW_VERSION= B

lesson_06/expression/src/expression_calculator.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@ export class ExpressionCalculator {
22
/** Returns a calculation involving a, b, c, d, and 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-
return 0;
5+
const addition = this.add(a, b);
6+
const exponent = this.pow(addition, c);
7+
const multiplication = this.multiply(d, e);
8+
const division = this.divide(exponent, multiplication);
9+
return division;
610
}
711

812
pow(base: number, exponent: number): number {
913
return Math.pow(base, exponent);
1014
}
15+
16+
add(a: number, b: number): number {
17+
return a + b;
18+
}
19+
20+
multiply(a: number, b: number): number {
21+
return a * b;
22+
}
23+
24+
divide(a: number, b: number): number {
25+
return a / b;
26+
}
1127
}

0 commit comments

Comments
 (0)