An algorithm is used to calculate the delivery cost of a courier parcel based on its weight in kilograms.
10 SEND "Parcel Courier Service" TO DISPLAY
11 SEND "Enter weight of parcel in kg:" TO DISPLAY
12 RECEIVE weight FROM (INTEGER) KEYBOARD
13 SEND "Calculating cost for " & weight & " kg" TO DISPLAY
14
15 IF (weight > 12) THEN
16 SET cost TO 35 + (3 * (weight - 12))
17 ELSE
18 IF (weight > 7) THEN
19 SET cost TO 35
20 ELSE
21 IF (weight > 3) THEN
22 SET cost TO 22
23 ELSE
24 SET cost TO 10
25 END IF
26 END IF
27 END IF
28
29 SEND "Total Cost: £" & cost TO DISPLAY
Complete the table to show the final output displayed by line 29 of the algorithm for each given input.
| Input | Output |
|---|---|
| 16 | |
| 3 | |
| 7 |