Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
Comments
richcb at 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 at 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
good
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.
  Permalink  
v2
Comments
Twinniez at 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 at 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 at 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
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 319
2 CPallini 275
3 DamithSL 214
4 Maciej Los 185
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2014
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