subject
Engineering, 19.11.2019 01:31 kraigstlistt

Write a program that will find the pairs of coordinates that are closest to each other, as if these were 2 planes in space, flying too close to each other. report of the 2 pairs of coordinates that are closest to each other. display a warning message such as: "alert, alert! plane at coordinate: x-axis, y-axis is too close to plane at coordinate: x-axis, y-axis."

hints:

(1) define a class that can hold 2 coordinates. call it the location class. implement the comparable interface, and thus create a compareto() method.
(2) create an array of location objects, from reading the input file. (note: the first record in the input file contains the number of records in the file).
(3) sort the array by either x- or y-coordinate (use either the insertion sort or the selection sort algorithm. do not use collections.
(4) compare each object in the sorted array with the previous object, and calculate their distance by using the pythagorean formula below: double distancebetween2points = math. sqrt((x2 - x1)^2 + (y2 - y1)^2)

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Steel is coated with a thin layer of ceramic to protect against corrosion. what do you expect to happen to the coating when the temperature of the steel is increased significantly? explain.
Answers: 1
question
Engineering, 04.07.2019 18:10
Water at 55c flows across a flat plate whose surface temperature is held constant at 95c. if the temperature gradient at the plate's surface for a given value of x is 18 c/mm, find a) local heat transfer coefficient. b) heat flux
Answers: 3
question
Engineering, 04.07.2019 19:10
How to increase the thermal officiency of an ideal simple rankino cycle? among these methods, which one is the best and why?
Answers: 2
question
Engineering, 04.07.2019 19:10
The sum of the normal stresses does not change as the stress state rotates through an angle. a)-trune b)- false
Answers: 2
You know the right answer?
Write a program that will find the pairs of coordinates that are closest to each other, as if these...
Questions
question
Mathematics, 04.05.2021 06:10
question
Mathematics, 04.05.2021 06:10
question
Mathematics, 04.05.2021 06:10
question
Mathematics, 04.05.2021 06:10
Questions on the website: 13722363