Cartesian Distance Calculation
Due: 9/12/03 at 1:00 pm
Write a Java application that will calculate the distance between two points (x1 ,y1) and ( x2,y 2) on a Cartesian coordinate plane using the formula:
d = (( x
1- x2
)2 +
( y1- y
2 )2
)1/2
Program requirements:
The completed assignment should be sent to [email protected]
It is recommended that you use the JDK 1.2 compiler with
Textpad or another editor for this assignment.
Please enter an integer x1:> 2
Please enter an integer x2:> 3
Please enter an integer y1:> 8
Please enter an integer y2:> -5
The distance between the points (2,3) and (8,-5) is:
XX
Would you like the distance between two other points (1-yes, 2-no) :> 1
Please enter an integer x1:> 2
Please enter an integer x2:> 3
Please enter an integer y1:> 8
Please enter an integer y2:> -a
ERROR --- Y2 must be numeric !
Please enter an integer x1:> 2
Please enter an integer x2:> 3
Please enter an integer y1:> 8
Please enter an integer y2:> -5
The distance between the points (2,3) and (8,-5) is:
XX
Would you like to find another GCD (1-yes, 2-no) :> 2
goodbye!