Skip to content
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

Chigazo Lesson 06 #240

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 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
30 changes: 28 additions & 2 deletions lesson_06/expression/src/expression_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
const Sum = this.add(a, b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your variable names should be lowerCamelCase, not ProperCase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

/* First step of PEMDAS in equation (Parenthesis)*/
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)
/* Fourth and final step of PEMDAS in equation [Multiplication/Division(left to right)]*/
const 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 function 'add'*/
}
multiply(Multiplicand: number, Multiplier: number): number {
/* defines value of Multiplicand and Multiplier; defines their return value*/
return Multiplicand * Multiplier;
/* 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 function 'divide'*/
}
pow(base: number, exponent: number): number {
return Math.pow(base, exponent);
}
}
}
2 changes: 1 addition & 1 deletion lesson_06/expression/tsconfig.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should revert changes to this file as they aren't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test came back with an error before I changed them

Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": ["node_modules", "build"]
}
}