-
Notifications
You must be signed in to change notification settings - Fork 25
Lesson 06-expression-calculator-for-kimberlee #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
21988e7
feat: lesson06 expression_calculator
haldanek 3e374b8
feat: lesson 06 expression_calculator edit
haldanek e7d053d
feat: lesson_06 expression_calculator edit 2
haldanek 3bf45c2
feat: lesson_06 expression_calculator edit 3
haldanek 60242c5
feat: lesson_06 expression_calculator edit 4
haldanek 79ed341
feat: lesson_06 expression_calculator edit 5
haldanek ee42d82
Merge branch 'code-differently:main' into lesson_06
haldanek e998f18
feat: lesson_06 expression_calculator edit 6
haldanek 62d1bf6
Merge branch 'code-differently:main' into lesson_06
haldanek 759645d
Merge branch 'code-differently:main' into lesson_06
haldanek c4baaca
Merge branch 'code-differently:main' into lesson_06
haldanek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
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; | ||
const P = this.add(a, b); | ||
const E = this.pow(d, e); | ||
const M = this.multiply(P, c); | ||
const D = this.divide(M, E); | ||
return D; | ||
//const expression = this.mult(this.add(a, b), c) / this.pow(d, e); | ||
//return expression; | ||
} | ||
|
||
pow(base: number, exponent: number): number { | ||
return Math.pow(base, exponent); | ||
const expo = Math.pow(base, exponent); | ||
return expo; | ||
} | ||
add(x: number, y: number): number { | ||
const addition = x + y; | ||
return addition; | ||
} | ||
multiply(X: number, Y: number): number { | ||
const multiply = X * Y; | ||
return multiply; | ||
} | ||
divide(x: number, y: number): number { | ||
const divide = x / y; | ||
return divide; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.