summaryrefslogtreecommitdiff
path: root/src/Triangle.java
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2019-05-05 19:36:09 -0600
committermokha <mokha@cisco.com>2019-05-05 19:36:09 -0600
commit3c2be35d16d7482442911f5b06b68512f86e15b5 (patch)
tree636edf7d09f2cc0b2f006c058071ce5b3d9adda6 /src/Triangle.java
parent46e409f3ca33ec3c7546d0589301c2a4f967c10a (diff)
butcher default directory structure to make instructor happy
Diffstat (limited to 'src/Triangle.java')
-rw-r--r--src/Triangle.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Triangle.java b/src/Triangle.java
new file mode 100644
index 0000000..cf45ec2
--- /dev/null
+++ b/src/Triangle.java
@@ -0,0 +1,29 @@
+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);
+ }
+}