Question: The following Point class has several errors; some are syntax errors and some are incorrect behavior. Find and fix them all. public class Point {
The following Point class has several errors; some are syntax errors and some are incorrect behavior. Find and fix them all.
public class Point
int x;
int y;
Returns the distance between this point and
public double distanceFromOrigin
return Math.sqrtx x y y;
Shifts this point's location by the given amount.
public void translateint dx int dy
x dx;
y dy;
class PointTest
public static void mainString args
Point p new Point;
ptranslate;
Point p new Point;
ptranslate;
Point p new Point;
ptranslate;
Point p new Point;
ptranslate;
Systemout.printlnDistance from origin of point px py is pdistanceFromOrigin;
Systemout.printlnDistance from origin of point px py is pdistanceFromOrigin;
System.out.printlnDistance from origin of point px py is pdistanceFromOrigin;
System.out.printlnDistance from origin of point px py is pdistanceFromOrigin;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
