Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lesson_06/expression/src/expression_calculator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
export class ExpressionCalculator {
/** Returns the calculation of ((a + b) * c) / d^e */
calculate(a: number, b: number, c: number, d: number, e: number): number {
const sum = this.add(a, b);
const product = this.multiply(sum, c);
const expo = this.pow(d, e);
// Implement your code here to return the correct value.
return 0;
return this.divide(product, expo);
}

pow(base: number, exponent: number): number {
return Math.pow(base, exponent);
}
add(num1: number, num2: number): number {
return num1 + num2;
}
multiply(num1: number, num2: number): number {
return num1 * num2;
}
divide(num1: number, num2: number): number {
return num1 / num2;
}
}