JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*This simple program takes 4 points entered and finds the distance between those two points in a straight line.
Insert coordinates of Y(a,b) and Z(c,d) as:
a
b
c
d
respectively.
Make sure to use a new line for each value
Hope you like it!
-Andre Daniel (Danidre)*/
import java.util.Scanner;
class DistanceBetweenTwoPoints
{
public static double getDistance(int x1, int x2, int y1, int y2) {
return Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x1, x2, y1, y2;
double distance;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run