2
0

implemented TriangleChecker

This commit is contained in:
Julian Hinxlage 2020-04-07 19:00:15 +02:00
parent ed0708ad84
commit d1f6addf0c

View File

@ -8,6 +8,19 @@ package de.hsel.sqs;
public class TriangleChecker { public class TriangleChecker {
public static TriangleType checkTriangle(int a, int b, int c) { public static TriangleType checkTriangle(int a, int b, int c) {
if(a < 0 || b < 0 || c < 0){
return TriangleType.NO_TRIANGLE;
}
if(a == b && a == c){
return TriangleType.EQUILATERAL_TRIANGLE;
}
if(a == b || a == c || b == c){
return TriangleType.ISOSCELESS_TRIANGLE;
}
if(a + b > c && a + c > b && b + c > a){
return TriangleType.SCALENE_TRIANGLE;
}
return TriangleType.NO_TRIANGLE; return TriangleType.NO_TRIANGLE;
} }
} }