well , to determine if u can create a triangle to begin with u need to check that 2 of the sides added together don't equal less than the largest side
this could be a simple if chain
public static boolean isValid(double side1, double side2, double side3){
boolean returnable = false;
if ( side1+ side2 <= side3){
if (side2 + side3 <= side 1){
if (side 1 + side3 <= side2){
returnable = false;
}else{
returnable = true;
}
else {
returnable = true;
}
else {
returnable = true;
}
}
return returnable;
}
untested but the logic should work
if statement 1 = true ,then u cant make a triangle , check statement 2
if statement 2 = true ,then u cant make a triangle , check statement 3
if statement 1 = true ,then u cant make a triangle at all , set the return value to false and return it
else if any of the above = false then a triangle can be made , set return value to true and return it
for the other method u will need to import the java.lang.StrictMath to use
public static double area(double side1, double side2, double side3){
double s = sqrt( (side1 + side2 + side3) / 2 ) ;
s = s * (s - side 1) * ( s - side2 ) * (s - side3 );
return s;
}
i used the formula u gave for it