Asp > Mathematics Code Examples

Nautical-Flight Functions

``` Nautical-Flight Functions 'miles per hour to knots Private Function MPHToKt(ByVal mph) MPHToKt = CDbl(CDbl(mph) / 1.152) End Function 'knots to miles per hour Private Function KtToMPH(ByVal kt) KtToMPH = CDbl(1.152 * CDbl(Kt)) End Function 'miles to nautical miles Private Function miToNautMi(ByVal miles) MiToNautMi = CDbl((CDbl(miles) * 5280) / 6076.1) End Function 'nautical miles to miles Private Function nautMiToMi(ByVal nautMi) NautMiToMi = CDbl((CDbl(nautMi) * 6076.1) / 5280) End Function 'flight time in minutes Private Function minsInFlight(ByVal nautMi, ByVal kt) MinsInFlight = CDbl((CDbl(nautMi) / CDbl(kt)) * 60) End Function 'nautical miles flown Private Function nautMiFlown(ByVal kt, ByVal mins) NautMiFlown = (CDbl(mins) / 60) * CDbl(CDbl(kt)) End Function 'average speed in knots Private Function ktSpeed(ByVal nautMi, ByVal mins) ktSpeed = CDbl(CDbl(nautMi) / (CDbl(mins) / 60)) End Function 'hours to minutes Private Function hrMins(ByVal hr) hrMins = CDbl(CDbl(hr) * 60) End Function 'seconds to minutes Private Function sdMins(ByVal sd) sdMins = CDbl(CDbl(sd) / 60) End Function 'gallons of fuel needed Private Function galFuel(ByVal mins, ByVal gph) galFuel = CDbl((CDbl(mins) / 60) * gph) End Function ```