Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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(); exercise3(); exercise9();

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

=+You couldn't expect more from a cow, could you?

Answered: 1 week ago