< previous page page_216 next page >

Page 216
Input: Temperature, an int value.
Output:
A prompt for input
Temperature (echo print)
Appropriate activity
Discussion: We must compare the temperature with the limits of each activity. Once the correct range is found, the corresponding activity is printed. We can make this comparison using If statements.
Main Module                    Level 0
Get temperature
Print activity

Get Temperature                    Level 1
Prompt for temperature value input
Read temperature
Echo-print temperature

Print Activity
Print The recommended activity is
IF temperature > 85
   Print swimming.
IF temperature <= 85 AND temperature > 70
   Print tennis.
IF temperature <= 70 AND temperature > 32
   Print golf.
IF temperature <= 32 AND temperature > 0
   Print skiing.
IF temperature <= 0
   Print dancing.

 
< previous page page_216 next page >