home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 3 / hamradioversion3.0examsandprograms1992.iso / tech / horizon / horizon.bas
BASIC Source File  |  1987-09-20  |  2KB  |  38 lines

  1. 5 DEFDBL A-Z
  2. 10 PRINT TAB(75)"                          "
  3. 20 PRINT TAB(30)"DISTANCE TO THE HORIZON"
  4. 30 PRINT TAB(75)"This program calculates the distance to the horizon"
  5. 40 PRINT"in both nautical and statute miles if the height above the ground"
  6. 50 PRINT"in feet is known. The calculation does not consider the ellipticity"
  7. 60 PRINT"of the Earth, so that it may be used at any place without any"
  8. 70 PRINT"appreciable error. The constants of multiplication used in the"
  9. 80 PRINT"calculations are based upon the Clarke spheroid of 1866, which"
  10. 90 PRINT"assumes the mean radius of the Earth to be 3,958.755 statute miles."
  11. 91 PRINT"For additional discussion, see <American Practical Navigator>,"
  12. 92 PRINT"originally by Nathaniel Bowditch, Washington, D. C.:"
  13. 93 PRINT"U. S. Navy Hydrographic Office (H. O.Pub. No. 9), 1966, p. 1187."
  14. 100 PRINT TAB(75)"Enter the height above the ground, in feet":INPUT N#
  15. 110 GOSUB 1000
  16. 120 A=R#*1.144
  17. 130 B=R#*1.317
  18. 140 C=INT(A)
  19. 150 D=A-C
  20. 160 E=D*5280
  21. 170 F=INT(E)
  22. 180 G=INT(B)
  23. 190 H=B-G
  24. 200 J=H*6076.11548556#
  25. 210 K=INT(J)
  26. 220 CLS
  27. 230 PRINT TAB(75)"                 "
  28. 240 PRINT TAB(75)"The distance to the horizon is";A;"nautical miles, or"
  29. 250 PRINT C;"nautical miles,";F;"feet."
  30. 260 PRINT TAB(75)"                           "
  31. 270 PRINT TAB(75)"The distance to the horizon is";B;"statute miles, or"
  32. 280 PRINT G;"statute miles,";K;"feet."
  33. 290 PRINT TAB(75)"                           "
  34. 300 PRINT TAB(75)"If you wish to run this program again, enter <F2>; to leave"
  35. 310 PRINT"this program, type the word 'system' and press RETURN."
  36. 320 END
  37. 1000 R#=SQR(N#):R#=R#/2!+N#/R#/2!:R#=R#/2!+N#/R#/2!:RETURN
  38.