Skip to content

Commit cfb55de

Browse files
committed
Implement getAngleType function with all angle cases and tests
1 parent ea0fca9 commit cfb55de

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
function getAngleType(angle) {
1111
if (angle === 90) {
1212
return "Right angle";
13+
}
14+
if (angle <90 ){
15+
return "Acute angle"
16+
}
17+
if (90<angle && angle<180) {
18+
return "Obtuse angle"
19+
}
20+
if (angle===180){
21+
return "Straight angle"
22+
}
23+
if (angle>180 && angle<=360){
24+
return "Reflex angle"
1325
}
1426
// Run the tests, work out what Case 2 is testing, and implement the required code here.
1527
// Then keep going for the other cases, one at a time.
@@ -50,14 +62,19 @@ assertEquals(acute, "Acute angle");
5062
// When the angle is greater than 90 degrees and less than 180 degrees,
5163
// Then the function should return "Obtuse angle"
5264
const obtuse = getAngleType(120);
65+
assertEquals(obtuse, "Obtuse angle")
5366
// ====> write your test here, and then add a line to pass the test in the function above
5467

5568
// Case 4: Identify Straight Angles:
5669
// When the angle is exactly 180 degrees,
5770
// Then the function should return "Straight angle"
71+
const straight= getAngleType(180);
72+
assertEquals(straight, "Straight angle")
5873
// ====> write your test here, and then add a line to pass the test in the function above
5974

6075
// Case 5: Identify Reflex Angles:
6176
// When the angle is greater than 180 degrees and less than 360 degrees,
77+
const reflex= getAngleType(210);
78+
assertEquals(reflex, "Reflex angle")
6279
// Then the function should return "Reflex angle"
6380
// ====> write your test here, and then add a line to pass the test in the function above

0 commit comments

Comments
 (0)