EDITED..
Oke, I managed to sort everything out, except, it does not calculate the area in area() method:
[COLOR="Red"]public static double area(double side1, double side2, double side3, double areaTri)[/COLOR] { double s = (side1 + side2 + side3)/2; areaTri = Math.sqrt(s*(s - side1)*(s - side2)*(s - side3)); //Returns to main() and should print out the last statement with the area return areaTri; }
Updated Code:
//Calculate the area of a triangle import java.util.Scanner; import static java.lang.Math.*; [COLOR="Lime"]public class MyTriangle[/COLOR] { [COLOR="Red"]public static void main(String[] args)[/COLOR] { double areaTri=0; Scanner input = new Scanner(System.in); System.out.print("Enter the size of the first side: "); double side1 = input.nextDouble(); System.out.print("Enter the size of the second side: "); double side2 = input.nextDouble(); System.out.print("Enter the size of the third side: "); double side3 = input.nextDouble(); isValid(side1,side2, side3, areaTri); System.out.println(""); System.out.println("The area of the triangle is "+ areaTri); } //Check if the sum of side1 and side2 is greater than side3 and if not returns false //If true calls on method area() [COLOR="Red"]public static boolean isValid(double side1, double side2, double side3, double areaTri)[/COLOR] { if(side1 * side2 > side3) { area(side1,side2,side3, areaTri); return true; } else { System.out.println("The input is invalid!"); return false; } } //calculates area of the triangle assuming conditions are met at method isValid() [COLOR="red"]public static double area(double side1, double side2, double side3, double areaTri)[/COLOR] { double s = (side1 + side2 + side3)/2; areaTri = Math.sqrt(s*(s - side1)*(s - side2)*(s - side3)); return areaTri; } }