Skip to content
Open
Show file tree
Hide file tree
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
63 changes: 58 additions & 5 deletions geom.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,85 @@
/* 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
module.exports = {
Rectangle: Rectangle,
Triangle: Triangle,
LineSegment: LineSegment
}
};
11 changes: 10 additions & 1 deletion pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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