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)
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
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