![]() |
A Simple Algorithm to Calculate Wavelength from Frequency |
![]() |
INPUT: frequency, band, units
OUTPUT: wavelength
CONSTANTS:
IF band = "AM"
THEN
wavelength = SPEED OF LIGHT/frequency
IF band = "FM"
THEN
wavelength = SPEED OF LIGHT x 1000/frequency
IF units = "feet" [Note: units are, by default, in meters]
THEN
wavelength = wavelength x METERS TO FEET
OUTPUT: wavelength
This computer program needs to be translated to a real computer language. You'll have to decide what language you want to use - and then you'll have to translate it into that language. However, that shouldn't be hard. If you can't do it yourself, see if you can find a teacher, a friend or an older student to help you.
The program that calculates the value of wavelength you saw on your screen was written in Perl, which is a language that people use when they are writing Web Sites. It is a little more complicated than this program because it has to "parse" (or understand) some of the ways the web pages "talk" to the computers that compute the wavelength.