From 5cc0b8511fc2e9a8e0069edcf0215c220887f145 Mon Sep 17 00:00:00 2001 From: Cogbonnia <244cogbonnia@gmail.com> Date: Wed, 9 Oct 2024 15:03:32 +0000 Subject: [PATCH] Lesson 06: Completed --- lesson_06/expression/src/expression_calculator.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 13cb2ca0..f63348da 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -1,8 +1,19 @@ export class ExpressionCalculator { /** Returns the calculation of ((a + b) * c) / d^e */ calculate(a: number, b: number, c: number, d: number, e: number): number { - // Implement your code here to return the correct value. - return 0; + return this.divide(this.multiply(this.add(a, b), c), this.pow(d, e)); + } + + add(a: number, b: number): number { + return a + b; + } + + multiply(value: number, c: number): number { + return value * c; + } + + divide(value: number, d: number): number { + return value / d; } pow(base: number, exponent: number): number {