Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
Question 61

An algorithm is used to calculate the hire fee for a workspace based on the booking duration hours and the member's tier level tier (where 1 represents Bronze, 2 represents Silver, and 3 represents Gold).

2 IF (hours <= 0) THEN
3     SEND ("Invalid duration") TO DISPLAY
4 ELSE
5     IF (hours > 2) AND (hours <= 8) THEN
6         IF (tier = 1) OR (tier = 2) THEN
7             SEND ("Standard booking: £15") TO DISPLAY
8         ELSE
9             IF (tier = 3) THEN
10                SEND ("Premium booking: £25") TO DISPLAY
11            ELSE
12                SEND ("Standard tier error") TO DISPLAY
13            END IF
14        END IF
15    ELSE
16        IF (hours > 0) AND (hours <= 2) THEN
17            IF (tier = 1) OR (tier = 2) THEN
18                SEND ("Short booking: £5") TO DISPLAY
19            ELSE
20                IF (tier = 3) THEN
21                    SEND ("VIP short booking: £10") TO DISPLAY
22                ELSE
23                    SEND ("Short tier error") TO DISPLAY
24                END IF
25            END IF
26        ELSE
27            SEND ("Duration category error") TO DISPLAY
28        END IF
29    END IF
30 END IF

The algorithm needs to be tested.

Construct test data to meet the requirements set out in the table below.

RequirementInput: hoursInput: tier
A condition generating 'Premium booking: £25'
A condition generating 'Duration category error'
A condition generating 'Short tier error'
[3]
Markscheme

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking

Question bank