Question
I need to: write a method that takes as parameters x1, y1, x2, and y2 where x1,y1 and x2,y2 are coordinate pairs in a 2-dimensional
I need to:
write a method that takes as parameters x1, y1, x2, and y2 where x1,y1 and x2,y2 are coordinate pairs in a 2-dimensional Cartesian space. This method is to calculate the distance between these two points and return that value.
All these go into a Java program where each is called by a method. Here is a portion of what that program could look like:
public static void main(String[] args){ exercise1(
int x1 = 37; int y1 = -42; int x2 = -5; int y2 = -20;
double distance = findDistance(x1, y1, x2, y2);
System.out.println("Distance between the points is: " + distance);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started