blob: 1b8d7323c9b3aac9645ab9c4cdd003584e81b8c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package ca.mokhan.comp268;
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);
}
}
|