package CUTexamples; public class Triangle { double a = 1 ; double b = 2 ; double c = 3 ; public Triangle() {} public void setA(double a) { this.a = a ; } public void setB(double b) { this.b = b ; } public void setC(double c) { this.c = c ; } public void reset() { a=1 ; b=2 ; c=3 ; } public boolean isIsoleces() { if (a*b*c <= 0) return false ; // incorrect if two of them are negative! double d = a-b ; d = d * (b-c) ; if (d == 0) return true ; // incorrect if it is a and c that are the same return false ; } public boolean isEquilateral() { return (a==b && b==c && a==c) ; } public boolean isScalene() { return (a!=b && b!=c && a!=c) ; } public boolean is(String ty) { if (ty.equals("equilateral")) return isEquilateral() ; if (ty.equals("isoleced")) return isIsoleces() ; if (ty.equals("scalene")) return isScalene() ; throw new IllegalArgumentException() ; } }