Question: Homework 2-4 How do I write this code in Java? In a cartesian coordinate plane, the distance between two point P1 with coordinates (X1, Y1)

Homework 2-4 How do I write this code in Java?

In a cartesian coordinate plane, the distance between two point P1 with coordinates (X1, Y1) and point P2 with coordinates (X2, Y2) is given by the formula

Write a program that prompts the user for the coordinates of both points, please note that all coordinates are double values. Your prompts must be:

Coordinates for P1

Enter X1:

Enter Y1:

Coordinates for P2

Enter X2:

Enter Y2:

Your output must be of the format:

Distance between P1 and P2 = computed distance

Please make sure to end each line of output with a newline.

Please note that your class should be named DistanceFormula.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!