implemented TriangleChecker
This commit is contained in:
parent
ed0708ad84
commit
d1f6addf0c
@ -8,6 +8,19 @@ package de.hsel.sqs;
|
||||
public class TriangleChecker {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user