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

  Improve the efficiency of their operations

To help improve the efficiency of their operations, the Maitre De has hired you to write a program that simulates people waiting for tables. The goal is to determine the average amount of time people spend waiting for tables.

  What is an illustration of a javascriptreg framework in the

what is an example of a javascriptreg framework? in the framework you have described what is an example of an

  Design and implement an application to manage a tournament

Design and implement an application to manage a tennis tournament of 16 players - design and implement an application to manage a tournament. Is there anybody who knows how to do this?

  Create java program to find number of days left in that year

Create a Java program called "DaysLeftInYear.java" that outputs the number of days left in that year. use the calendar class to represent dates. Use the DateFormat class to display the current date in the output.

  Consider the game matrix

Consider the following game in matrix form with two players. Payoffs for the row player Izzy are indicated first in each cell, and payoffs for the column player Jack are second.

  Create a package called people

Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.

  How do i change the option for jvm heap memory in tomcat

How and where do I change the option for JVM heap memory in Tomcat? Where are the servlet source files for JSPs compiled in Tomcat?

  Write a java program in a netbeans project that reads a

write a java program in a netbeans project that reads a text file containing the names and addresses of several people

  Design and implement a sorting algorithm

Your task is to design and implement a sorting algorithm and running time grows as a linear function of the array

  Draw the uml diagram for the class

Draw the UML diagram for the class and then implement the class. Write a program that creates two rectangles objects, one with width 4 and height 40 and the other with width 3.5 and height 35.9

  Displays the stored array values on the screen

Displays the stored array values on the screen using WriteInt - Prompts the user for integer input a dozen times

  What are the three types of errors

What are the three types of errors that you can encounter in a Java program? Describe them, and explain how you would minimize the errors

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