From f1077c93cce2bf13349ab280ccfdc3c945ef40f6 Mon Sep 17 00:00:00 2001 From: ASMAA-86 Date: Tue, 5 Feb 2019 08:47:53 +0300 Subject: [PATCH 1/2] last update --- geom.js | 57 ++++++++++++++++++++++++++++++++++++---- pull_request_template.md | 11 +++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/geom.js b/geom.js index d942747..ce60a7f 100644 --- a/geom.js +++ b/geom.js @@ -1,27 +1,74 @@ +/* Rectangle */ class Rectangle { constructor(length, width) { this.length = length; this.width = width; } -} + isSquare(lengthNum, widthNum) { + if (lengthNum === widthNum) + //if ( this.length === this.width) + return true; + } + + area(lengthNum, widthNum) { + let area = lengthNum * widthNum; + return area; + } + + perimeter(lengthNum, widthNum) { + let perimeter = 2 * (lengthNum + widthNum); + return perimeter; + } +} +/* Triangle */ class Triangle { - constructor(sideA, sideB, sideC){ + constructor(sideA, sideB, sideC) { this.sideA = sideA; this.sideB = sideB; this.sideC = sideC; } -} + isEquilateral(first, second, third) { + if (first === second && first === third && second === third) { + return true; + } + } + + isIsosceles(first, second, third) { + if (first === second || first === third || second === third) { + 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 +76,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 From 115a008683c7e0777095837f689982c2d4212662 Mon Sep 17 00:00:00 2001 From: ASMAA-86 Date: Tue, 5 Feb 2019 09:10:16 +0300 Subject: [PATCH 2/2] last last update --- geom.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/geom.js b/geom.js index ce60a7f..6963e71 100644 --- a/geom.js +++ b/geom.js @@ -5,19 +5,17 @@ class Rectangle { this.width = width; } - isSquare(lengthNum, widthNum) { - if (lengthNum === widthNum) - //if ( this.length === this.width) - return true; + isSquare() { + if (this.length === this.width) return true; } - area(lengthNum, widthNum) { - let area = lengthNum * widthNum; + area() { + let area = this.length * this.width; return area; } - perimeter(lengthNum, widthNum) { - let perimeter = 2 * (lengthNum + widthNum); + perimeter() { + let perimeter = 2 * (this.length + this.width); return perimeter; } } @@ -30,14 +28,22 @@ class Triangle { this.sideC = sideC; } - isEquilateral(first, second, third) { - if (first === second && first === third && second === third) { + isEquilateral() { + if ( + this.sideA === this.sideB && + this.sideA === this.sideC && + this.sideB === this.sideC + ) { return true; } } - isIsosceles(first, second, third) { - if (first === second || first === third || second === third) { + isIsosceles() { + if ( + this.sideA === this.sideB || + this.sideA === this.sideC || + this.sideB === this.sideC + ) { return true; } }