An algorithm is used to calculate the rental price of an electric bicycle based on the number of hours rented.
10 SEND "Welcome to E-Bike Rentals" TO DISPLAY
11 SEND "How many hours do you want to rent?" TO DISPLAY
12 RECEIVE hours FROM (INTEGER) KEYBOARD
13 SEND "Pricing for " & hours & " hour(s)" TO DISPLAY
14
15 IF (hours > 8) THEN
16 SET price TO 40 + (5 * (hours - 8))
17 ELSE
18 IF (hours > 5) THEN
19 SET price TO 40
20 ELSE
21 IF (hours > 2) THEN
22 SET price TO 30
23 ELSE
24 SET price TO 15
25 END IF
26 END IF
27 END IF
28
29 SEND "Total: £" & price TO DISPLAY
Complete the table to show the final output displayed by line 29 of the algorithm for each given input.
| Input | Output |
|---|---|
| 10 | |
| 1 | |
| 6 |
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.