From f820ea557c1342ec73768b59fee4f077fc9a839a Mon Sep 17 00:00:00 2001 From: Abdullah Date: Mon, 4 Feb 2019 21:15:35 +0300 Subject: [PATCH] HW done --- geom.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/geom.js b/geom.js index d942747..c6dcdc5 100644 --- a/geom.js +++ b/geom.js @@ -3,6 +3,23 @@ class Rectangle { this.length = length; this.width = width; } + + isSquare(){ + if(this.length === this.width ){ + return true ; + } + else { return false;} + } + + area(){ + var TheArea = this.length * this.width; + return TheArea ; + } + + perimeter(){ + var Theperimeter = 2*(this.length + this.width); + return Theperimeter ; + } } @@ -12,9 +29,35 @@ class Triangle { this.sideB = sideB; this.sideC = sideC; } + + isEquilateral(){ + if(this.sideA === this.sideB && this.sideB === this.sideC){ + return true ; + } + } + + isIsosceles(){ + if(this.sideA === this.sideB || this.sideB === this.sideC || this.sideA === this.sideC ){ + return true; + } + } + + area(){ + var s = (this.sideA + this.sideB + this.sideC)/2; + var area = Math.sqrt(s*((s-this.sideA)*(s-this.sideB)*(s-this.sideC))); + return area; + } + + isObtuse(angle){ + if(angle >= 90){ + return true; + } + } + } + class LineSegment { constructor(x1, y1, x2, y2){ this.x1 = x1; @@ -22,6 +65,11 @@ class LineSegment { this.x2 = x2; this.y2 = y2; } + + length(){ + var FindTheLength = math.sqrt((this.x2-this.x1)*(this.x2-this.x1)+(this.y2-this.y1)*(this.y2-this.y1)); + return FindTheLength; + } } // NOTE: DO NOT REMOVE OR ALTER