Commit f263324
Changed files (1)
src/Q3/CartesianCoordinateSystem.java
@@ -1,6 +1,24 @@
+/**
+ * Assignment 1, COMP268 Class: CartesianCoordinateSystem.java
+ *
+ * @description Represents an object that can calculate the distance between two points on a
+ * cartesian plain
+ * @author: mo khan Student ID: 3431709
+ * @date May 7, 2019
+ * @version 1.0
+ */
package Q3;
public class CartesianCoordinateSystem {
+ /**
+ * Calculate the distance between two points.
+ *
+ * @param x1 x coordinate for the first point.
+ * @param y1 y coordinate for the first point.
+ * @param x2 x coordinate for the second point.
+ * @param y2 y coordinate for the second point.
+ * @return the distance between the two points
+ */
public double calculateDistance(double x1, double y1, double x2, double y2) {
return Math.round(Math.pow(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2), 0.5) * 100) / 100.0;
}