An energy supplier utilizes an algorithm to calculate home power tariffs based on the time of day, day of the week, and current electricity usage.
1 # Smart home power tariff allocator
2
3 IF (hour >= 23) OR (hour < 6) THEN
4 SEND ("Economy night rate") TO DISPLAY
5 ELSE
6 IF (isWeekend == TRUE) THEN
7 IF (powerUsage > 5.5) THEN
8 SEND ("Peak weekend rate") TO DISPLAY
9 ELSE
10 SEND ("Standard weekend rate") TO DISPLAY
11 END IF
12 ELSE
13 IF (hour >= 16) AND (hour <= 19) THEN
14 SEND ("Peak weekday rate") TO DISPLAY
15 ELSE
16 SEND ("Off-peak weekday rate") TO DISPLAY
17 END IF
18 END IF
19 END IF
State the name of the programming construct used in line 6 of the algorithm.
50 exam-style questions on Edexcel GCSE Computer Science Constructs, covering Structural components of programs and Writing programs with control constructs. Each one has a worked solution and a mark scheme showing where the marks go.