Skip to content

Commit 9dd422c

Browse files
completed function to get angle types and wrote the assertions for it
1 parent 8f3d6cf commit 9dd422c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@
88
// Then, write the next test! :) Go through this process until all the cases are implemented
99

1010
function getAngleType(angle) {
11+
if(angle===180){
12+
return "Straight angle"
13+
}
14+
if(angle>90 && angle<180){
15+
return "Obtuse angle"
16+
}
1117
if (angle === 90) {
1218
return "Right angle";
19+
}
20+
if (angle < 90) {
21+
return "Acute 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.
@@ -49,15 +61,20 @@ assertEquals(acute, "Acute angle");
4961
// Case 3: Identify Obtuse Angles:
5062
// When the angle is greater than 90 degrees and less than 180 degrees,
5163
// Then the function should return "Obtuse angle"
52-
const obtuse = getAngleType(120);
5364
// ====> write your test here, and then add a line to pass the test in the function above
65+
const obtuse = getAngleType(120);
66+
assertEquals(obtuse, "Obtuse angle");
5467

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

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

0 commit comments

Comments
 (0)