I have to create a quadrilateral program for school where you put in two points and find the area. For the Public double getArea() part it says "return type double is not compatible with void" How do I fix it?
Main class
public class Point {
double x;
double y;
public Point(double pX, double pY){
// this.x = x;
// this.y = y;
x = pX;
y = pY;
}
public void setX (double pX){
// this.x = x;
x = pX;
}
public void setY (double pY){
// this.y = y;
y = pY;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
@Override
public String toString(){
return String.format("(" + x + "," + y + ")");
}
}
Quadrilateral class
Trapezoid(double ptX,double ptY){
super(ptX,ptY);
}
public double getArea(){
return (x*y)/2;
}
@Override
public String toString(){
return String.format ("Trapezoid coords: " + "(" + x + "," + y + ")",
"Area: " + getArea());