12,072,067 members (57,905 online)
Rate this:
See more:
Hey =) I'm doing some studying pre-exams, and i have this excercise where they want me to create a program that will give the user "Flight time" when he inserts where he wants to travel from, destination, and which speed he wants to fly in. Also they added a list of destinations, and 2 startng places , showing distance from the 2 startng places to all destinations. Any idead how i should do this?
All help would be much apreciated =)
Thank you !
Posted 20-May-13 9:21am
Edited 20-May-13 9:22am
v2
richcb 20-May-13 14:23pm

I have several. What is your idea? This is a very simple task. Take each step one by one and think about what you need in order to complete it.
Twinniez 20-May-13 15:27pm

I rly just wonder what method to use... :P Im quite the noob, so if you by any chance could like point me in the right direction :P

Rate this:

## Solution 1

Time = Distance/Speed

If you only have lat/long of the locations, look up Great Circle Formula to get the formula on how to calculate the distance between two points on the globe. Then for each starting place, calculate the distance to every other place in your list.

BTW, its important to note about the Distance/Speed formula, that the denominator needs to be in the same units as the numerator. For example, 100km/50mph != 2h, even though thats the answer you will get. Make sure that if your numerator is in kilometers, the the denominator is in kph, if numerator is in miles, denominator must be mph.
v2
Twinniez 20-May-13 15:18pm

hmm :) thanks alot! But im aware of how to do the math, the programming is what stops me :) I'm quite the noob when it comes to this, so what my real question is (though quite poorly pointed out) what method/how to program it :P
Ron Beyer 20-May-13 15:34pm

There are tons of references, all you have to do is search, like this one:
http://www.codeproject.com/Articles/12269/Distance-between-locations-using-latitude-and-long
Then using the number you get from that, divide by the entered speed, and voila! Time!
Twinniez 20-May-13 15:35pm

Thanks! :)

Top Experts
Last 24hrsThis month
 OriginalGriff 385 CPallini 255 Dave Kreskowiak 225 F-ES Sitecore 220 Richard MacCutchan 145
 Dave Kreskowiak 2,461 OriginalGriff 2,009 Richard MacCutchan 1,675 CPallini 1,297 CHill60 1,219