-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise02_15.java
More file actions
33 lines (27 loc) · 924 Bytes
/
Copy pathExercise02_15.java
File metadata and controls
33 lines (27 loc) · 924 Bytes
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
29
30
31
32
33
package Chapter2;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author jorda
*/
public class Exercise02_15 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter x1: ");
double x1 = input.nextDouble();
System.out.print("Enter y1: ");
double y1 = input.nextDouble();
System.out.print("Enter x2: ");
double x2 = input.nextDouble();
System.out.print("Enter y2: ");
double y2 = input.nextDouble();
double temp = Math.pow(x2-x1, 2) + Math.pow(y2 - y1, 2);
double result = Math.pow(temp, .5);
System.out.println("The distance between the two points is" + result);
}
}