Skip to content

Course home

Sign up

Develop code

EasyMediumHard
1234567891011121314151617
Question 11

An electricity company uses an algorithm to determine tariff rates based on the season, whether it is a weekend, and the hour of the day.

1  # Electricity Tariff Calculator
2  IF (season = "Summer") THEN
3      SEND "High Summer Rates apply" TO DISPLAY
4  ELSE
5      IF (season = "Winter") OR (season = "Autumn") THEN
6          IF (isWeekend = TRUE) THEN
7              SEND "Weekend Holiday Rates apply" TO DISPLAY
8          ELSE
9              IF (hour >= 16) AND (hour <= 19) THEN
10                 SEND "Peak Evening Rates apply" TO DISPLAY
11             ELSE
12                 SEND "Off-Peak Rates apply" TO DISPLAY
13             END IF
14         END IF
15     ELSE
16         SEND "Standard Spring Rates apply" TO DISPLAY
17     END IF
18 END IF

Construct suitable test data (providing a value for season, isWeekend, and hour) that will test the algorithm by causing it to display "Off-Peak Rates apply".

[3]
Markscheme

Develop code Questions

  1. GCSE
  2. /Computer Science
  3. /Develop code

51 exam-style questions on Edexcel GCSE Computer Science Develop code, covering Decomposition and abstraction to solve problems, Read, write, analyse and refine programs, Converting algorithms into programs, Techniques for readable, maintainable code, Identifying and correcting program errors, and Evaluating program fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank