diff --git a/geom.js b/geom.js index d942747..6963e71 100644 --- a/geom.js +++ b/geom.js @@ -1,27 +1,80 @@ +/* Rectangle */ class Rectangle { constructor(length, width) { this.length = length; this.width = width; } -} + isSquare() { + if (this.length === this.width) return true; + } + + area() { + let area = this.length * this.width; + return area; + } + + perimeter() { + let perimeter = 2 * (this.length + this.width); + return perimeter; + } +} +/* Triangle */ class Triangle { - constructor(sideA, sideB, sideC){ + constructor(sideA, sideB, sideC) { this.sideA = sideA; this.sideB = sideB; this.sideC = sideC; } -} + isEquilateral() { + if ( + this.sideA === this.sideB && + this.sideA === this.sideC && + this.sideB === this.sideC + ) { + return true; + } + } + + isIsosceles() { + if ( + this.sideA === this.sideB || + this.sideA === this.sideC || + this.sideB === this.sideC + ) { + return true; + } + } + area(base, height) { + let area = (b * h) / 2; + } + isObtuse(angle) { + if (angle > 90) { + return true; + } + } +} +/* LineSegment */ class LineSegment { - constructor(x1, y1, x2, y2){ + constructor(x1, y1, x2, y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } + lengthCalculator() { + let length1 = this.y1 - this.x1; + let length2 = this.y2 - this.x2; + console.log( + "The diffiranc between x1,y1" + + length1 + + "The diffiranc between x2,y2" + + length2 + ); + } } // NOTE: DO NOT REMOVE OR ALTER @@ -29,4 +82,4 @@ module.exports = { Rectangle: Rectangle, Triangle: Triangle, LineSegment: LineSegment -} +}; diff --git a/pull_request_template.md b/pull_request_template.md index a911ef9..2f04959 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,14 +1,23 @@ ### How difficult did you find this (0 - 10)? (0 very easy, 10 very difficult) +7 ### How long did it take? +one hour/ for rivision and planning. +one hour /for typing and testing, Although I need more than hour. -### Was there anything that you struggled with? If so, what? +### Was there anything that you struggled with? If so, what? +yes, how to use the properties inside the methods espicaly if I pass an arguments. ### Is there anything that you would like some further information on? +I need more practise and time. ### Do you have any suggestions to improve this assignment? +adding the math equation will make it much easier. + +Thank you , +Asmaa