Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Programming questions

Question

Who was the principles author of the declaration of independence?

Answered: 1 week ago

Question

Main issue that caused the American civil war?

Answered: 1 week ago

Question

Which event marked the official end of the American civil war ?

Answered: 1 week ago