An eighteen year old with a $500,000 credit limit applies for a rental card. Will the program approve?
No.
Remember the SOUND
statement
(last heard from in chapter 9):
SOUND frequency,duration
In this statement,
Here is a program (which you have seen before) which asks the user for a frequency, and then plays that frequency for about one second.
' Tuning Fork Program ' PRINT "Enter the frequency (37-32000):" INPUT FREQ SOUND FREQ, 18 END
The program expects the user to enter a correct frequency value.
If the user does not, the SOUND
statement will not work.
A better program tests FREQ
before executing the SOUND
statement:
' Tuning Fork Program ' PRINT "Enter the frequency (37-32000):" INPUT FREQ IF ____________ AND _____________ THEN SOUND FREQ, 18 ELSE PRINT "Frequency is out of range" END IF ' END
Fill each blank with a relational expression
so that FREQ
is tested in two ways:
FREQ
must be equal or greater than 37.FREQ
must be less than or equal to 32000.Hint: pick the relational symbols (>=, <=, etc.) carefully.