-
Notifications
You must be signed in to change notification settings - Fork 0
/
slope2v2.py
59 lines (52 loc) · 1.98 KB
/
slope2v2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#Runway Slope Calculator by Tom Knudsen
#This program takes input from a user and calcualtes the airport's runway slope gradient for use in Boeing 737 FMC
# Version 1.0 - Date 03.07.2019
# Support and suggestion [email protected]
def main(): #Defines a main function
import time
import os
os.system('cls') #Clear Screen
#Prints out Title Header
print('///////////////////////')
print('Runway Slope Calculator')
print('Version 1.0')
print('by Tom Knudsen')
print('///////////////////////')
print()
time.sleep(3) #waits for 3 seconds
#Calculates elevation variance and slope
elevationH = int(input('Please enter highest runway elevation in feet: '))
time.sleep(1)
elevationL = int(input('Please enter lowest runway elevation in feet: '))
time.sleep(1)
runwayLenght = int(input('Please enter total runway lenght in meter: '))
time.sleep(1)
print('Please wait, calculating....')
print() #new line
time.sleep(2)
calculatedElevation = (elevationH - elevationL)
calculatedSlope = (calculatedElevation / runwayLenght) * 100
#Checks and converts the answer into string for concatination and prints out answer appended with string U or string D depending on the value
if (calculatedSlope) <= 0.0:
a = (calculatedSlope)
b = round(a, 1)
corrected = str(b) + str('D')
print('Your Runway Slope Gradient is: ', corrected)
else:
a = (calculatedSlope)
b = round(a, 1)
corrected2 = str(b) + ' ' + str('U')
print('Your Runway Slope Gradient is: ', corrected2)
time.sleep(1)
print() #new line
#checks if the user wants to restart the program
restr=input('Do you want to restart, (y/n): ').lower()
if restr == 'y':
print('One second....')
time.sleep(2)
main()
else:
print('Have a nice day')
time.sleep(1)
exit()
main()