diff options
| author | mokha <mokha@cisco.com> | 2019-05-08 18:26:09 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-05-08 18:26:09 -0600 |
| commit | 2a799b8a63d64c12115f50e7a3f08fbb1cbf8698 (patch) | |
| tree | 3a8b888dfd202e5eebb056d220f8a88e93c1c17b | |
| parent | 29306db620ab55b2a2469c04589d19b5e252f38e (diff) | |
add documentation
| -rw-r--r-- | src/Q6/Triangle.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Q6/Triangle.java b/src/Q6/Triangle.java index 6b3b6ce..d3a6225 100644 --- a/src/Q6/Triangle.java +++ b/src/Q6/Triangle.java @@ -1,28 +1,51 @@ +/** + * Assignment 1, COMP268 Class: Triangle.java + * + * @description Represents an employee savings account. + * @author: mo khan Student ID: 3431709 + * @date May 8, 2019 + * @version 1.0 + */ package Q6; public class Triangle { public static double NULL = 0.0; private double a, b, c; + /** + * Constructs a Triangle + * + * @param a the length of side A + * @param b the length of side B + * @param c the length of side C + */ public Triangle(double a, double b, double c) { this.a = a; this.b = b; this.c = c; } + /** @return the length of side A */ public double getA() { return this.a; } + /** @return the length of side B */ public double getB() { if (this.b == NULL) this.b = Math.sqrt(Math.pow(this.getC(), 2) - Math.pow(this.getA(), 2)); return this.b; } + /** @return the length of side C */ public double getC() { return this.c; } + /** + * Determines if the triangle is a right angle triangle. + * + * @return boolean to indicate if the triangle is a right angle triangle + */ public boolean isRightTriangle() { return Math.pow(this.getA(), 2) + Math.pow(this.getB(), 2) == Math.pow(this.getC(), 2); } |
