- Write a method of type double called triangleArea which takes in two parameters of type double for the base and height of a triangle and returns the area.
Here is my code. On line "triangleArea(height,base);" an error message displays: **cannot find symbol symbol: variable height location: class HWA
cannot find symbol symbol: variable base location: class HWA Assign Return Value to New Variable
public class HWA {
public static void main(String[] args{
triangleArea(height,base);
}
public static double triangleArea(double height, double base){
height = 12;
base = 6;
double equal = (1/2)*(height*base);
return equal;
}
}
What am I doing wrong or how can I fix it and still follow the requirements listed above?