summaryrefslogtreecommitdiff
path: root/src/Q3
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2019-05-07 09:24:33 -0600
committermokha <mokha@cisco.com>2019-05-07 09:24:33 -0600
commitf263324f457897de8a1fd95250526d9114b84778 (patch)
treef7cdeb346406370892d8df688d8cbc9eb23cff41 /src/Q3
parent4cbaffe1c5f5c0806ae864110994e8813a24314f (diff)
add documentation
Diffstat (limited to 'src/Q3')
-rw-r--r--src/Q3/CartesianCoordinateSystem.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Q3/CartesianCoordinateSystem.java b/src/Q3/CartesianCoordinateSystem.java
index b825cc2..c41dbeb 100644
--- a/src/Q3/CartesianCoordinateSystem.java
+++ b/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;
}