Question
Write a program that prompts the user to enter two points (x1, y1) and (x2, y2). Calculate and display the distance between the two points
Write a program that prompts the user to enter two points (x1, y1) and (x2, y2). Calculate and display the distance between the two points using the formula below. Round the answer up to 2 decimal points. You can use Math.pow(a,0.5) to compute the square root of an expression. Math.pow() returns a double.
For example, the distance between the points (2, 3) and (4, 4) is approximately 7.28, as shown below.
please do this in java, make one class without a main method and one with a main method to call a method public double calculateDistance(double x1, double x2, double y1, double y2)
using scanner class thank you.
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