An algorithm is designed to calculate the shipping charge for an automated drone delivery service based on the weight of a parcel in kilograms, as shown below:
10 SEND "Welcome to DroneDrop Delivery" TO DISPLAY
11 SEND "Enter package weight in kg:" TO DISPLAY
12 RECEIVE weight FROM (INTEGER) KEYBOARD
13 SEND "Processing rate for " & weight & " kg" TO DISPLAY
14
15 IF (weight > 15) THEN
16 SET charge TO 45 + (8 * (weight - 15))
17 ELSE
18 IF (weight > 8) THEN
19 SET charge TO 45
20 ELSE
21 IF (weight > 3) THEN
22 SET charge TO 25
23 ELSE
24 SET charge TO 12
25 END IF
26 END IF
27 END IF
28
29 SEND "Total shipping charge: £" & charge TO DISPLAY
The algorithm needs to be thoroughly tested.
Complete the table to give suitable input test data to meet the requirements.
| Requirement | Input Test Data |
|---|---|
| Output charge = 25 | |
| An output that is not correct (logical error) |
159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.