Question 6

Edexcel Computer Science June 2019 Paper 2GCSE12 marks

On the specification

(a)
6.2 Program constructs
(b)(i)
6.6 Subprograms
(b)(ii)
6.2 Program constructs
(b)(iii)
6.4 Input and output
Question text

6 Margaret uses a program to help her determine the selling price for each batch of ice cream based on the production cost, profit and tax. (a) The pseudocode for an algorithm to calculate the selling price of ice cream is shown. The items TAX and PROFIT are constants. Explain why it is good programming practice to define values as constants, rather than as fixed values in the code. (2) (b) The partially completed pseudocode for a different algorithm to calculate the selling price of ice cream is shown. It uses a subprogram. (i) Complete the pseudocode by supplying values for the blanks. (5) Line 8 Line 9 Line 26 Line 36 (ii) Explain how the correct value for the variable message is chosen on line 21. (2) (iii) The user enters the value for tax rate on line 35. Tax is a percentage, for example, 0.03 is 3% tax. The entered value needs to be validated. Construct two validation tests. Test data for Test 1 is provided. Give an example of invalid test data for Test 2. (3) Test Validation test Test data Test 1 -0.03 Test 2 (Total for Question 6 = 12 marks)