Click here to Skip to main content
13,003,150 members (58,823 online)
Rate this:
Please Sign up or sign in to vote.
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 8:21am
Updated 20-May-13 8:22am
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

1 solution

Rate this: bad
Please Sign up or sign in to vote.

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.
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:
Then using the number you get from that, divide by the entered speed, and voila! Time!
Twinniez 20-May-13 15:35pm
Thanks! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170626.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100