1、The return value of the function's return type and definitions should be consistent
//modify public LineSegment scaleByFactor(double scalar) {
public double scaleByFactor(double scalar) {
scalarX = x2 + (x2 - x1) * length;
scalarY = y2 + (y2 - x1) * length;
return scalar;
}
2、I suggest you use eclipse to edit the source code, it has a very nice error prompt