From ec6133b74ede9b668eb729fadbb06aae386b18a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Mon, 7 Oct 2024 22:19:56 +0000 Subject: [PATCH 1/7] feat: added math functions; added calculate results; --- .../expression/src/expression_calculator.ts | 30 +++++++++++++++++-- lesson_06/expression/tsconfig.json | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 13cb2ca0..41e74e64 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -2,10 +2,36 @@ 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; + let Sum = this.add(a, b) + /* First step of PEMDAS in equation (Parenthesis)*/ + let Product = this.multiply(Sum, c) + /* Second step of PEMDAS in equation (Parenthesis)*/ + let Power = Math.pow(d, e) + /* Third step of PEMDAS in equation (Exponent)*/ + let Quotient = this.divide(Product, Power) + /* Fourth and final step of PEMDAS in equation [Multiplication/Division(left to right)]*/ + let Result = Quotient + /* Defines final result */ + return Result; + /* prints final result*/ } + add(Augend: number, Addend: number,): number { + /* defines value of Augend and Addend; defines their return value*/ + return Augend * Addend; + /* defines the fuction 'add'*/ + } + multiply(Multiplicand: number, Multiplier: number): number { + /* defines value of Multiplicand and Multiplier; defines their return value*/ + return Multiplicand + Multiplier; + /* defines the fuction 'multiply'*/ + } + divide(Dividend: number, Divisor: number): number { + /* defines value of Dividend and Divisor; defines their return value*/ + return Dividend / Divisor; + /* defines the fuction 'divide'*/ + } pow(base: number, exponent: number): number { return Math.pow(base, exponent); } -} +} \ No newline at end of file diff --git a/lesson_06/expression/tsconfig.json b/lesson_06/expression/tsconfig.json index ced0628a..96d7f3f5 100644 --- a/lesson_06/expression/tsconfig.json +++ b/lesson_06/expression/tsconfig.json @@ -111,4 +111,4 @@ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "exclude": ["node_modules", "build"] -} +} \ No newline at end of file From 76a596fd8acbb569b7e2c3f3b8928567e9478e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Mon, 7 Oct 2024 22:24:57 +0000 Subject: [PATCH 2/7] feat: added math functions; added calculate results; --- lesson_06/expression/src/expression_calculator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 41e74e64..34e35a98 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -2,7 +2,7 @@ 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. - let Sum = this.add(a, b) + let Sum = this.add(a, b) /* First step of PEMDAS in equation (Parenthesis)*/ let Product = this.multiply(Sum, c) /* Second step of PEMDAS in equation (Parenthesis)*/ From 6c35e4a505e0cfd71bb7f31fb22139e44d96e9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Mon, 7 Oct 2024 22:34:21 +0000 Subject: [PATCH 3/7] fix: corrected function spelling; --- lesson_06/expression/src/expression_calculator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 34e35a98..3bd391fe 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -19,17 +19,17 @@ export class ExpressionCalculator { add(Augend: number, Addend: number,): number { /* defines value of Augend and Addend; defines their return value*/ return Augend * Addend; - /* defines the fuction 'add'*/ + /* defines the function 'add'*/ } multiply(Multiplicand: number, Multiplier: number): number { /* defines value of Multiplicand and Multiplier; defines their return value*/ return Multiplicand + Multiplier; - /* defines the fuction 'multiply'*/ + /* defines the function 'multiply'*/ } divide(Dividend: number, Divisor: number): number { /* defines value of Dividend and Divisor; defines their return value*/ return Dividend / Divisor; - /* defines the fuction 'divide'*/ + /* defines the function 'divide'*/ } pow(base: number, exponent: number): number { return Math.pow(base, exponent); From c12e9fd152b23e358c2410e5e4de77b725135892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Wed, 9 Oct 2024 13:17:59 +0000 Subject: [PATCH 4/7] fix: updated 'let' to 'commit' --- lesson_06/expression/src/expression_calculator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 3bd391fe..d0108d5e 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -2,15 +2,15 @@ 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. - let Sum = this.add(a, b) + const Sum = this.add(a, b) /* First step of PEMDAS in equation (Parenthesis)*/ - let Product = this.multiply(Sum, c) + const Product = this.multiply(Sum, c) /* Second step of PEMDAS in equation (Parenthesis)*/ - let Power = Math.pow(d, e) + const Power = Math.pow(d, e) /* Third step of PEMDAS in equation (Exponent)*/ - let Quotient = this.divide(Product, Power) + const Quotient = this.divide(Product, Power) /* Fourth and final step of PEMDAS in equation [Multiplication/Division(left to right)]*/ - let Result = Quotient + const Result = Quotient /* Defines final result */ return Result; /* prints final result*/ From f3dd6daf23aad0183109cb1fb796732f98c627bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Wed, 9 Oct 2024 13:26:03 +0000 Subject: [PATCH 5/7] fix: swapped 'add' and 'multiply' return statement; --- lesson_06/expression/src/expression_calculator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index d0108d5e..7673b77f 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -18,12 +18,12 @@ export class ExpressionCalculator { add(Augend: number, Addend: number,): number { /* defines value of Augend and Addend; defines their return value*/ - return Augend * Addend; + return Augend + Addend; /* defines the function 'add'*/ } multiply(Multiplicand: number, Multiplier: number): number { /* defines value of Multiplicand and Multiplier; defines their return value*/ - return Multiplicand + Multiplier; + return Multiplicand * Multiplier; /* defines the function 'multiply'*/ } divide(Dividend: number, Divisor: number): number { From db31cf133b50fa470c762a4d71d52fc53a781a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Sat, 12 Oct 2024 03:08:39 +0000 Subject: [PATCH 6/7] fix: converted ProperCase to lowerCamelCase; --- lesson_06/expression/src/expression_calculator.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 7673b77f..29d93452 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -2,17 +2,17 @@ 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. - const Sum = this.add(a, b) + const sum = this.add(a, b) /* First step of PEMDAS in equation (Parenthesis)*/ - const Product = this.multiply(Sum, c) + const product = this.multiply(Sum, c) /* Second step of PEMDAS in equation (Parenthesis)*/ - const Power = Math.pow(d, e) + const power = Math.pow(d, e) /* Third step of PEMDAS in equation (Exponent)*/ - const Quotient = this.divide(Product, Power) + const quotient = this.divide(Product, Power) /* Fourth and final step of PEMDAS in equation [Multiplication/Division(left to right)]*/ - const Result = Quotient + const result = quotient /* Defines final result */ - return Result; + return result; /* prints final result*/ } From f5d06a1df0ed7c856674384c3e41c32ba7498d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CA1-4U2T1NN=E2=80=9D?= <“a1.austinn19@gmail.com”> Date: Sat, 12 Oct 2024 03:11:12 +0000 Subject: [PATCH 7/7] fix: fixed more case errors; --- lesson_06/expression/src/expression_calculator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lesson_06/expression/src/expression_calculator.ts b/lesson_06/expression/src/expression_calculator.ts index 29d93452..dc922193 100644 --- a/lesson_06/expression/src/expression_calculator.ts +++ b/lesson_06/expression/src/expression_calculator.ts @@ -4,11 +4,11 @@ export class ExpressionCalculator { // Implement your code here to return the correct value. const sum = this.add(a, b) /* First step of PEMDAS in equation (Parenthesis)*/ - const product = this.multiply(Sum, c) + const product = this.multiply(sum, c) /* Second step of PEMDAS in equation (Parenthesis)*/ const power = Math.pow(d, e) /* Third step of PEMDAS in equation (Exponent)*/ - const quotient = this.divide(Product, Power) + const quotient = this.divide(product, power) /* Fourth and final step of PEMDAS in equation [Multiplication/Division(left to right)]*/ const result = quotient /* Defines final result */