Skip to content

Commit 023c553

Browse files
Implement logic to identify reflex angles in getAngleType function
1 parent 34d3bc5 commit 023c553

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ function getAngleType(angle) {
1111
if (angle === 90) {
1212
return "Right angle";
1313
}
14-
if(angle<90){
15-
return "Acute angle"
14+
if (angle < 90) {
15+
return "Acute angle";
1616
}
17-
if(angle>90 && angle<180){
18-
return "Obtuse angle"
17+
if (angle > 90 && angle < 180) {
18+
return "Obtuse angle";
1919
}
20-
if(angle===180){
21-
return "Straight angle"
20+
if (angle === 180) {
21+
return "Straight angle";
2222
}
23-
// Run the tests, work out what Case 2 is testing, and implement the required code here.
24-
// Then keep going for the other cases, one at a time.
23+
if(angle>180 && angle<360){
24+
return "Reflex angle"
25+
}
26+
// Run the tests, work out what Case 2 is testing, and implement the required code here.
27+
// Then keep going for the other cases, one at a time.
2528
}
2629

2730
// The line below allows us to load the getAngleType function into tests in other files.
@@ -59,17 +62,22 @@ assertEquals(acute, "Acute angle");
5962
// When the angle is greater than 90 degrees and less than 180 degrees,
6063
// Then the function should return "Obtuse angle"
6164
const obtuse = getAngleType(120);
62-
assertEquals(obtuse,"Obtuse angle")
65+
assertEquals(obtuse, "Obtuse angle");
6366
// ====> write your test here, and then add a line to pass the test in the function above
6467

6568
// Case 4: Identify Straight Angles:
6669
// When the angle is exactly 180 degrees,
6770
// Then the function should return "Straight angle"
6871
// ====> write your test here, and then add a line to pass the test in the function above
69-
const straight=getAngleType(180);
70-
assertEquals(straight,"Straight angle")
72+
const straight = getAngleType(180);
73+
assertEquals(straight, "Straight angle");
7174

7275
// Case 5: Identify Reflex Angles:
7376
// When the angle is greater than 180 degrees and less than 360 degrees,
7477
// Then the function should return "Reflex angle"
75-
// ====> 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(210);
80+
assertEquals(reflex, "Reflex angle");
81+
82+
const reflex2 = getAngleType(350);
83+
assertEquals(reflex2, "Reflex angle");

0 commit comments

Comments
 (0)