There are four errors in the pseudocode in Figure 2 which is designed to count and output the number of low (negative value), normal (zero value), and high (positive value) water level readings.
Write the correct code for line 10.
Figure 2
| Line | Code |
|---|---|
| 01 | |
| 02 | SET levels TO [1, -2, 0, 3, -1, 2, 0] |
| 03 | |
| 04 | SET low TO 0 |
| 05 | SET high TO 0 |
| 06 | SET index TO 0 |
| 07 | |
| 08 | WHILE NOT (index > LENGTH(levels)) DO |
| 09 | |
| 10 | IF levels[index] >= 0 THEN |
| 11 | SET high TO levels[index] |
| 12 | ELSE |
| 13 | IF levels[index] < 0 THEN |
| 14 | SET low TO low + 1 |
| 15 | END IF |
| 16 | END IF |
| 17 | |
| 18 | SET index TO index + 1 |
| 19 | |
| 20 | END WHILE |
| 21 | |
| 22 | SEND "Low readings: " & low TO DISPLAY |
| 23 | SEND "Normal readings: " & (high + low) TO DISPLAY |
| 24 | SEND "High readings: " & high TO DISPLAY |
| 25 |