I've tried for hours to fix the errors in this simple program for a class I am taking. Help would be appreciated.import java.lang.Math; public class triangle { double area; double s; public double findArea(double sideA, double sideB, double sideC); { s= 0.5 *(sideA + sideB + sideC); area = Math.sqrt(s*(s-sideA)*(s-sideB)*(s-sideC)); System.out.println("The area of the triangle is " + area); return area; } } import java.util.Scanner public static void main(String[] args) { Formula triangle = new Formula(); double a,b,c; Scanner inputTriangle = new Scanner(System.in); System.out.println("Enter side a of triangle"); a = inputTriangle.nextDouble(); System.out.println("Enter side b of triangle"); b = inputTriangle.nextDouble(); System.out.println("Enter side c of triangle"); c = inputTriangle.nextDouble(); triangle.findArea(a, b, c); } }
Errors I am getting:
Triangle.java:23: error: class, interface, or enum expected
import java.util.Scanner
^
Triangle.java:25: error: class, interface, or enum expected
public static void main(String[] args) {
^
Triangle.java:28: error: class, interface, or enum expected
double a,b,c;
^
Triangle.java:30: error: class, interface, or enum expected
Scanner inputTriangle = new Scanner(System.in);
^
Triangle.java:31: error: class, interface, or enum expected
System.out.println("Enter side a of triangle");
^
Triangle:32: error: class, interface, or enum expected
a = inputTriangle.nextDouble();
^
Triangle.java:33: error: class, interface, or enum expected
System.out.println("Enter side b of triangle");
^
Triangle:34: error: class, interface, or enum expected
b = inputTriangle.nextDouble();
^
Triangle:35: error: class, interface, or enum expected
System.out.println("Enter side c of triangle");
^
Triangle.java:36: error: class, interface, or enum expected
c = inputTriangle.nextDouble();
^
Triangle.java:37: error: class, interface, or enum expected
triangle.findArea(a, b, c);
^
Triangle.java:38: error: class, interface, or enum expected
}
^
12 errors