Skip to content
MathsGenie logo
Open app

Course home

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

Subprograms

EasyMedium
123456789101112131415161718192021222324252627282930
Question 15

A program is written to calculate the tax on a shopping item.

1 FUNCTION calculateTax(price)
2 BEGIN FUNCTION
3     IF price > 100 THEN
4         tax = price * 0.20
5     ELSE
6         tax = price * 0.05
7     END IF
8     RETURN tax
9 END FUNCTION
10
11 SEND "Enter the item price: " TO DISPLAY
12 RECEIVE userPrice FROM (REAL) KEYBOARD
13 SET finalTax TO calculateTax(userPrice)
14 SEND ("Tax to pay: " & finalTax) TO DISPLAY

Identify the name of a parameter used in this pseudocode.

[1]

Subprograms Questions

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