diff --git a/lesson_06/expression/.env.test b/lesson_06/expression/.env.test index 56cf4a06f..93aef4eca 100644 --- a/lesson_06/expression/.env.test +++ b/lesson_06/expression/.env.test @@ -1 +1 @@ -HW_VERSION=your assigned version here \ No newline at end of file +HW_VERSION=F \ No newline at end of file diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 76b215c42..6bf4492e8 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -1,11 +1,24 @@ export class ExpressionCalculator { /** Returns a calculation involving a, b, c, d, and e */ calculate(a: number, b: number, c: number, d: number, e: number): number { - // Implement your code here to return the correct value. - return 0; + // Function to implement: a * Math.pow(b + c, d) / e + const addition = this.add(b, c); + const exponentiation = this.pow(addition, d); + const multiplication = this.multiply(a, exponentiation); + const division = this.divide(multiplication, e); + return division; } pow(base: number, exponent: number): number { return Math.pow(base, exponent); } + add(a: number, b: number): number { + return a + b; + } + multiply(a: number, b: number): number { + return a * b; + } + divide(a: number, b: number): number { + return a / b; + } }