Wize Programming and Numerical Methods Textbook > Algorithm Design and Problem Solving
Flowcharts and Pseudocode
An engineer writes the pseudocode below to estimate the speed of a small package falling from a drone. It uses Euler time steps with gravitational acceleration 9.81 m/s2 and a linear drag term of 0.2 s−1 times the current speed. Speeds are in m/s and times in s.
Plain text
v ← 0
t ← 0
dt ← 0.5
WHILE t < 2.0
a ← 9.81 − 0.2 × v
v ← v + a × dt
t ← t + dt
END WHILE
OUTPUT vTrace the pseudocode by hand. What value of v does it output? Give your answer in m/s, to two decimal places.
A ventilation controller reads an integer temperature T in °C and a switch state S, which is either 0 or 1. The flowchart outputs a fan command as a percentage of maximum speed. Each row below is a separate execution with new inputs. Complete the table with the exact integer command percentages, without percent signs.
| Temperature (°C) | Switch state | Command (%) |
| 28 | 0 | |
| 29 | 1 | |
| 30 | 1 | |
| 44 | 1 | |
| 45 | 1 | |
| 52 | 0 |