Okay, so I've got my directories in IntelliJ like this:
- src has
Main
class and aShape
class - src\Shapes has
Triangle
andSquare
class
Now, in f.e Triangle
would look like this:
package Shapes;
public class Triangle extends Shape {
public double half;
public Triangle(Double a, Double b, Double c){
Edges.add(a); Edges.add(b); Edges.add(c);
for (Double edge:
Edges) {
half+=edge/2.0;
}
}
public double Surface(){
return Math.sqrt(half*(half-Edges.get(0))*(half-Edges.get(1))*(half-Edges.get(2)));
}
}
It looked like this and it worked just before I made Shapes
dir and I moved Triangle
and Square
there. So now, how can I make this class extend
a class which is in a previous directory?
That's the structure: