Browse Source

Erkennt gleichseitiges Dreieck

05.11.2024
Peter Kessler 1 month ago
parent
commit
b32156c6bc
2 changed files with 12 additions and 2 deletions
  1. 6
    1
      src/praktikum02/TriangleChecker.java
  2. 6
    1
      test/praktikum02/TriangleCheckerTest.java

+ 6
- 1
src/praktikum02/TriangleChecker.java View File

@@ -49,7 +49,12 @@ public class TriangleChecker {

// Analyse der Dreiecksart
public static TriangleType checkTriangle(float a, float b, float c) {
return TriangleType.NORMAL;
if(a==b && a==c){
return TriangleType.EQUILATERAL;
}
else{
return TriangleType.NORMAL;
}
}



+ 6
- 1
test/praktikum02/TriangleCheckerTest.java View File

@@ -8,6 +8,11 @@ class TriangleCheckerTest {

@Test
void checkTriangle() {
assertEquals(TriangleChecker.TriangleType.NORMAL,TriangleChecker.checkTriangle(5,6,7));
assertEquals(TriangleChecker.TriangleType.NORMAL, TriangleChecker.checkTriangle(5, 6, 7));
}
@Test
void checkGleichseitig() {
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, TriangleChecker.checkTriangle(1,1,1));
}

}

Loading…
Cancel
Save