JAVA how would I
can anyone tell me what an algorithm for the following situation would look like?
i need to make a program in which the user enters a city name and x and y coordinates. depending on how many cities are entered, a recursion algorithm is used to determine the distance between the cities.
like the following:
if the user enters 3 cities and their coordinates:
chicago x = 300 y = 500
miami x = 100 y = 100
toledo x = 10 y = 10
then the program takes the x and y values to find the distance between the cities so the out put would look like:
chicago to miami = 500 miles
miami to toledo = 180 miles
total miles = 680 miles
thank you in advance
Re: JAVA how would I
To measure the distance between the two cities, already there are classes and methods in java.awt that convert rectangular screen co-ordiantes to polar co-ordinates. To find out that you need to provide the appropriate class with (int x, int y, int delta-x, int delta-y) using city first(x,y) for the first two then city second(x,y) to the second pair of ints then call rectangular to polar and get magnitude on the result.
|Tags: recursion algorithm|
|Thread Tools||Search this Thread|
|Similar Threads for: "JAVA how would I"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Java Auto Updater wants me to update java everyday in Windows 7||minajoh||Windows Software||4||04-09-2013 11:04 PM|
|Setting Of Java to The Point At Manual Java||winni||Software Development||4||10-01-2011 10:05 PM|
|Java Programming using Adventnet SNMP Java API||ROCKING_Suhas||Software Development||5||17-07-2010 06:52 AM|
|Link List Example in Java Sample program in Java||trickson||Software Development||2||04-08-2009 08:23 PM|