Question: 6. (40 points) Write the class Point, which represents a 2-dimensional point and the class Edge which represents a 2-dimensional edge. A point is given

6. (40 points) Write the class Point, which represents a 2-dimensional point and the class Edge which represents a 2-dimensional edge. A point is given by two coordinates x and y and an edge is given by two points. Your edge class should provide the getLength method which computes the length of the edge. You should appropriately decide which fields and methods to provide additionally. public class Point { private double x, y; // Write this part public class Edge { private Point s, t; // Write this part public final double getLength() { // Write this part You must use the modifiers abstract, final, private, protected, public, and static appropriately. In order to get full credit on this problem, it is not enough that your code merely works. You may lose points if you do not use appropriate modifiers where they clearly belong. Tip: to calculate the length of an edge, you should return the square root of the sum of the squared difference of the coordinates. Formally, Length = /[s t)2 + (s2 tz)2, where s = (S1,S2) and t = (t ,tz). 6. (40 points) Write the class Point, which represents a 2-dimensional point and the class Edge which represents a 2-dimensional edge. A point is given by two coordinates x and y and an edge is given by two points. Your edge class should provide the getLength method which computes the length of the edge. You should appropriately decide which fields and methods to provide additionally. public class Point { private double x, y; // Write this part public class Edge { private Point s, t; // Write this part public final double getLength() { // Write this part You must use the modifiers abstract, final, private, protected, public, and static appropriately. In order to get full credit on this problem, it is not enough that your code merely works. You may lose points if you do not use appropriate modifiers where they clearly belong. Tip: to calculate the length of an edge, you should return the square root of the sum of the squared difference of the coordinates. Formally, Length = /[s t)2 + (s2 tz)2, where s = (S1,S2) and t = (t ,tz)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
