summaryrefslogtreecommitdiff
path: root/src/Q3/CartesianCoordinateSystem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q3/CartesianCoordinateSystem.java')
-rw-r--r--src/Q3/CartesianCoordinateSystem.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Q3/CartesianCoordinateSystem.java b/src/Q3/CartesianCoordinateSystem.java
new file mode 100644
index 0000000..d6681f9
--- /dev/null
+++ b/src/Q3/CartesianCoordinateSystem.java
@@ -0,0 +1,7 @@
+package ca.mokhan.assignment1;
+
+public class CartesianCoordinateSystem {
+ 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;
+ }
+}