diff options
| author | mokha <mokha@cisco.com> | 2019-05-05 19:57:14 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-05-05 19:57:14 -0600 |
| commit | 7b4cb6a2eef3a0fcde7e998832427c73599e4a0a (patch) | |
| tree | 75acc7cd8f3bd8a087e909db182c9e18a66879a1 /src/section-6 | |
| parent | 99a28d2dba93642e89a62ecf905a3bd4f138318d (diff) | |
use the exact naming convention for directories described by instructor
Diffstat (limited to 'src/section-6')
| -rw-r--r-- | src/section-6/Triangle.java | 29 | ||||
| -rw-r--r-- | src/section-6/TriangleTest.java | 25 |
2 files changed, 0 insertions, 54 deletions
diff --git a/src/section-6/Triangle.java b/src/section-6/Triangle.java deleted file mode 100644 index cf45ec2..0000000 --- a/src/section-6/Triangle.java +++ /dev/null @@ -1,29 +0,0 @@ -package ca.mokhan.assignment1; - -public class Triangle { - public static double NULL = 0.0; - private double a, b, c; - - public Triangle(double a, double b, double c) { - this.a = a; - this.b = b; - this.c = c; - } - - public double getA() { - return this.a; - } - - public double getB() { - if (this.b == NULL) this.b = Math.sqrt(Math.pow(this.getC(), 2) - Math.pow(this.getA(), 2)); - return this.b; - } - - public double getC() { - return this.c; - } - - public boolean isRightTriangle() { - return Math.pow(this.getA(), 2) + Math.pow(this.getB(), 2) == Math.pow(this.getC(), 2); - } -} diff --git a/src/section-6/TriangleTest.java b/src/section-6/TriangleTest.java deleted file mode 100644 index 7b85c01..0000000 --- a/src/section-6/TriangleTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package ca.mokhan.assignment1; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class TriangleTest extends TestCase { - public TriangleTest(String testName) { - super(testName); - } - - public static Test suite() { - return new TestSuite(TriangleTest.class); - } - - public void testIsRightTriangle() { - assertFalse(new Triangle(45.0, 55.0, 75.0).isRightTriangle()); - assertTrue(new Triangle(28.0, 45.0, 53.0).isRightTriangle()); - } - - public void testGetB() { - assertEquals(64.0, new Triangle(48.0, Triangle.NULL, 80.0).getB()); - assertEquals(35.0, new Triangle(84.0, Triangle.NULL, 91.0).getB()); - } -} |
