Skip to content
Open
Changes from all 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
57 changes: 55 additions & 2 deletions geom.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@

class Rectangle {
constructor(length, width) {
this.length = length;
this.width = width;
}
isSquare(number){
if(Math.sqrt(number)%1===0)//check if the number is a square or not. and i'm not sure if that describes the required function.
{
return true;
}
else {
return false;
}

}
area(){
calArea=this.length*this.width ;
console.log(calArea);
}
perimeter()
{
calPer=2*(this.length*this.width);
console.log(calArea);
}
}


Expand All @@ -12,10 +32,43 @@ class Triangle {
this.sideB = sideB;
this.sideC = sideC;
}
}
isEquilateral(){
if(this.sideA===60&&this.sideB===60&&this.sideC===60){
return true;
}
else
{
return false;
}
}
isIsosceles(){
if(this.sideA===this.sideB){
return true;
}
else
{
return false;
}
}
area(){
let semi=(this.sideA+this.sideB+this.sideC)/(2);
let numbers= semi*(semi-this.sideA)*(semi-this.sideB)*(semi-this.sideC);
Area= Math.sqrt(numbers);
console.log(Area);

}
isObtuse(){
if (this.sideA>90||this.sideB>90||this.sideC>90){
return true;
}
else
{
return false;
}
}
}

class LineSegment {
class LineSegment { // the last question, i dont know which equation to use
constructor(x1, y1, x2, y2){
this.x1 = x1;
this.y1 = y1;
Expand Down