Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Constructs

EasyMedium
1234567891011121314
Question 12

The pseudocode below is used to calculate a customer savings discount based on their order amount.

1 FUNCTION calculateDiscount(totalPrice)
2 BEGIN FUNCTION
3     IF totalPrice >= 100 THEN
4         discount = totalPrice * 0.10
5     ELSE
6         discount = 0
7     END IF
8     RETURN discount
9 END FUNCTION
10
11 SEND "Enter order amount: " TO DISPLAY
12 RECEIVE orderAmount FROM (REAL) KEYBOARD
13 SET finalDiscount TO calculateDiscount(orderAmount)
14
15 IF finalDiscount > 0 THEN
16     SEND ("You saved £" & finalDiscount) TO DISPLAY
17 ELSE
18     SEND ("No discount applied.") TO DISPLAY
19 END IF

Identify a line number where selection starts.

[1]

Constructs Questions

  1. IGCSE
  2. /Computer Science
  3. /Constructs