Skip to content

Commit 3760f67

Browse files
committed
The 1-get-angle-type.js has been solved
1 parent 8f3d6cf commit 3760f67

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
function getAngleType(angle) {
1111
if (angle === 90) {
1212
return "Right angle";
13+
} else if (angle < 90) {
14+
return "Acute angle";
15+
} else if (angle > 90 && angle < 180) {
16+
return "Obtuse angle";
17+
} else if (angle === 180) {
18+
return "Straight angle";
1319
}
14-
// Run the tests, work out what Case 2 is testing, and implement the required code here.
15-
// Then keep going for the other cases, one at a time.
20+
else {
21+
return "Reflex angle";
22+
}
23+
24+
25+
// Run the tests, work out what Case 2 is testing, and implement the required code here.
26+
// Then keep going for the other cases, one at a time.
1627
}
1728

1829
// The line below allows us to load the getAngleType function into tests in other files.
@@ -51,13 +62,17 @@ assertEquals(acute, "Acute angle");
5162
// Then the function should return "Obtuse angle"
5263
const obtuse = getAngleType(120);
5364
// ====> write your test here, and then add a line to pass the test in the function above
65+
assertEquals(obtuse, "Obtuse angle");
5466

5567
// Case 4: Identify Straight Angles:
5668
// When the angle is exactly 180 degrees,
5769
// Then the function should return "Straight angle"
5870
// ====> write your test here, and then add a line to pass the test in the function above
59-
71+
const straight = getAngleType(180);
72+
assertEquals(straight, "Straight angle");
6073
// Case 5: Identify Reflex Angles:
6174
// When the angle is greater than 180 degrees and less than 360 degrees,
6275
// 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
76+
// ====> write your test here, and then add a line to pass the test in the function above
77+
const reflex=getAngleType(240);
78+
assertEquals(reflex,"Reflex angle");

0 commit comments

Comments
 (0)