diff --git a/lesson_06/expression/.env.test b/lesson_06/expression/.env.test index 56cf4a06f..b77a3d9ed 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=A diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 76b215c42..4e952b9f2 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -2,10 +2,33 @@ 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; + const addition = this.add(a, b); + // const multiplication2 = this.multiply(addition, c); + // console.log(multiplication2); + const multiplication = this.multiply(addition, c); + const exponent = this.pow(d, e); + const division = this.divide(multiplication, exponent); + return division; } + // Function to implement: (a + b) * c / Math.pow(d, e) pow(base: number, exponent: number): number { return Math.pow(base, exponent); } + + add(a: number, b: number): number { + return a + b; + } + + multiply(a: number, c: number): number { + return a * c; + } + + divide(a: number, b: number): number { + return a / b; + } + + + // A: (a: number, b: number, c: number, d: number, e: number) => + // ((a + b) * c) / Math.pow(d, e), }