I am in chapter 5 working on the intersecting lines. The Point class page I have a critical error on line 14...Here is how it reads:
//Create a point from another Point object
14 Point(final Point oldPoint) {
x = oldPoint.x; //Copy x coordinate
y = oldPoint.y; //Copy y coordinate
}
When I look at it it says: Multiple markers at this line ( Point final Point oldPoint) oldPoint can not be resolved to a variable...Know how to fix that but it does not fix the problem; next it says; Description Resource Path Location Type
oldPoint cannot be resolved to a variable Point.java /Try Geometry/src line 14 Java Problem
Syntax error on token ",", ; expected Point.java /Try Geometry/src line 20 Java Problem
Syntax error on token "(", ; expected Point.java /Try Geometry/src line 20 Java Problem
Syntax error on token "(", ; expected Point.java /Try Geometry/src line 27 Java Problem
Syntax error on token ")", ; expected Point.java /Try Geometry/src line 20 Java Problem
Syntax error on token ")", ; expected Point.java /Try Geometry/src line 27 Java Problem
Syntax error on token "final", @ expected Point.java /Try Geometry/src line 14 Java Problem
Syntax error on token "String", new expected Point.java /Try Geometry/src line 32 Java Problem
Syntax error, insert ";" to complete Statement Point.java /Try Geometry/src line 14 Java Problem
Syntax error, insert ";" to complete Statement Point.java /Try Geometry/src line 32 Java Problem
Syntax error, type annotations are illegal here Point.java /Try Geometry/src line 14 Java Problem
The constructor Point(Point) is undefined Line.java /Try Geometry/src line 8 Java Problem
The constructor Point(Point) is undefined Line.java /Try Geometry/src line 9 Java Problem
The method distance(Point) is undefined for the type Point Line.java /Try Geometry/src line 19 Java Problem
The method move(double, double) is undefined for the type Point TryGeometry.java /Try Geometry/src line 16 Java Problem
toString cannot be resolved to a type Point.java /Try Geometry/src line 32 Java Problem
void is an invalid type for the variable move Point.java /Try Geometry/src line 20 Java Problem
Void methods cannot return a value Point.java /Try Geometry/src line 28 Java Problem
Void methods cannot return a value Point.java /Try Geometry/src line 33 Java Problem
Here is the code...for the point class : import static java.lang.Math.sqrt;
Code:
public class Point {
//Coordinates of the point
double x;
double y;
//Create a point from coordinates
Point(double xVal, double yVal) {
x = xVal;
y = yVal;
//Create a point from another Point object
Point(final Point oldPoint) {
x = oldPoint.x; //Copy x coordinate
y = oldPoint.y; //Copy y coordinate
}
//Move a point
void move(double xDelta, double yDelta) {
//Parameter values are increments to the current coordinates
x += xDelta;
y += yDelta;
}
//Calculate the distance to another point
double distance(final Point aPoint) {
return sqrt((x - aPoint.x)*(x - aPoint.x) + (y - aPoint.y)*(y - aPoint.y));
}
//Convert a point to a string
public String toString() {
return Double.toString(x) + ", " + y; //As "x,y"
}
}
}
The code starts on page 188 and goes to page 193