An algorithm is designed to calculate the rental fee for a bicycle hire scheme as shown below:
10 SEND "Welcome to Cycle Rentals" TO DISPLAY
11 SEND "How many hours do you wish to rent?" TO DISPLAY
12 RECEIVE hours FROM (INTEGER) KEYBOARD
13 SEND "Cost based on " & hours & " hours" TO DISPLAY
14
15 IF (hours > 10) THEN
16 SET fee TO 30 + (5 * (hours - 10))
17 ELSE
18 IF (hours > 6) THEN
19 SET fee TO 30
20 ELSE
21 IF (hours > 2) THEN
22 SET fee TO 20
23 ELSE
24 SET fee TO 10
25 END IF
26 END IF
27 END IF
28
29 SEND "Total fee: " & fee TO DISPLAY
The algorithm needs to be tested more thoroughly.
Complete the table to give suitable input test data to meet the requirements.
| Requirement | Input Test Data |
|---|---|
| Output fee = 20 | |
| 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.