Compute the distance between the first two points

Assignment Help JAVA Programming
Reference no: EM13861142

The town of Even-ville is getting into the car infotainment business. There is a request to implement some features of a GPS navigation system with a built in recommendation system. As a reminder a GPS uses graph and geometric algorithms to calculate distances and map a route. One of the geometric problems is the closest-pair problem. Given a set of points, the closest-pair problem is to find the two points that are nearest to each other. We are asked to use the second closest pair solution for our recommendation system.

We will first write a program that computes the distances between all pair of points and find the one with the second smallest distance as follows:

1. Ask the user to enter the number of points.

2. Ask the user to enter x and y positions for each point. S tore the positions in a 2-D array. What should the dimensions of the 2-D array be?

3. Compute the distance between the first two points and initialize the variable that represents the second shortest distance. Recall that the distance between the two points (x1, y1) and (x2, y2) is computed by taking the square root of the quantity (x1 - x2)^2 + (y1 - y2)^2.

4. Use a nested for loop to compute the distance for every two points and update the second shortest distance and the two points with the second shortest distance.

5. Display the second shortest distance and the second closest two points.

Reference no: EM13861142

Questions Cloud

Movement was meant to communicate : a. The reading discusses the Harlem Renaissance, jazz, and blues music. What do you think that this movement was meant to communicate? Do you think it was effective in its purposes?
What is the main purpose : Then answer the following questions by writing several paragraphs (a minimum of 500 words, typed, double spaced/12 point font) that analyze the pro or con position or both. Include your name and section number on a separate title page.What is the mai..
Describe how dna has enhanced law enforcement : Describe how DNA has enhanced law enforcement. What are some of the anticipated changes to this technology
Compare and contrast a work with a movie adaptation : 1. Compare and contrast a work with a movie adaptation.  For example, compare the recent movie version ofBeowulf to the Anglo-Saxon poem or the film Excalibur to Malory. Let me know what adaptation you'd like to write about if it isn't on this list, ..
Compute the distance between the first two points : Compute the distance between the first two points and initialize the variable that represents the second shortest distance - Display the second shortest distance and the second closest two points.
Consider the lobster : What is the main argument in "Consider the Lobster" by David Foster Wallace?
Explain tay-sachs disease and provide a discussion : Explain Tay-Sachs disease and provide a discussion of the information
Write paper in which you define right of privacy : Write a 450-word paper in which you define right of privacy, search, seizure, arrest, and reasonableness
Rewrite the following letter correct format errors : Rewrite the following letter. Correct format errors, change out-of-date wording, change negative 3. vocabulary to positive words, and eliminate redundancies. June 8th, '14Teresa McGlennon Niagara County Technologies Company

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd