Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Ask the user to input four pairs of x,y coordinates in this format: x0 y0 x1 y1 x2 y2 x3 y3 Use the SimplePoint class below and add a main() method to it. The main() method should create a SimplePoint...

1 answer below »
Ask the user to input four pairs of x,y coordinates in this format: x0 y0 x1 y1 x2 y2 x3 y3 Use the SimplePoint class below and add a main() method to it. The main() method should create a SimplePoint object for each pair of x,y coordinates. Next, it should determine which of the four points is furthest from point 0,0. Finally, the main() method should output the x,y coordinates of the furthest point, along with the distance. Match the sample run below. Here is the SimplePoint class: public class SimplePoint { private double x,y; public SimplePoint(double x1, double y1) { x = x1; y = y1; } public double getX() { return x; }; public double getY() { return y; }; public double distance(SimplePoint p) { return Math.sqrt( Math.pow(p.getX()-x,2) + Math.pow(p.getY()-y,2) ); } } The program filename must be: SimplePoint.java
Program name:SimplePoint.java
Sample Runs:
Enter four pairs of x,y coordinates: XXXXXXXXXX XXXXXXXXXXThe point that's furthest from 0,0 is x,y 4.0,4.0 with distance: 5.66.
Answered 3 days After Dec 20, 2021

Solution

Sathishkumar answered on Dec 22 2021
107 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here