Question 2(c)(ii) 2018 · October-November · Paper 21 · 2 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (c)
(ii)
Question 2
Show text version of question
Question 2
Part (c)
(ii)
Question 2
Shop customers have a discount card with a unique card number. Customers collect points after
they have bought items. The more points they have, the bigger the discount. If they shop on a Wednesday, their discount is increased by 20%.
The function GetDiscountRate() takes a card number as a parameter and returns the discount rate for a customer based on the number of points they have collected. A flowchart for the function is shown.
The function uses the following variables and functions.
Identifier Data type Description DRate REAL The discount rate CardNum STRING The unique customer card number Points INTEGER The number of points collected Takes the card number as a parameter and returns the GetPoints() FUNCTION number of points already collected Today() FUNCTION Returns the day number: 1 for Monday, 2 for Tuesday etc.
START
DRate 0
Points GetPoints(CardNum)
Is YES Points > 199 ? DRate 0.2
NO
Is YES Points > 99 ? DRate 0.1
NO
Is Today = YES DRate DRate * 1.2 Wednesday ?
NO
RETURN DRate
END
Question 5
There are different ways to minimise the risk of errors when writing programs, such as the use of constants and library routines.
(ii)
Write pseudocode to declare one of the constants you have given in part (c)(i).
.......................................................................................................................................[2]
Why this question appears here
82% assigned-topic match · Data types and structures › Data types and records
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_w18_qp_21.pdf
