Question 14

AQA Computer Science June 2022 Paper 1 (7516/1)AS13 marks

On the specification

14.1
3.1 Fundamentals of programming3.2 Fundamentals of data structures
14.2
3.3 Systematic approach to problem solving
Question text

14 This question extends the functionality of the Skeleton Program. The user is to be allowed to clear the contents of the most recently changed cells. To do this, they will enter a negative integer when prompted to enter a row, column and digit. The integer will represent the number of cells to be cleared. For example, if the user enters -3, the three most recently entered digits should each be replaced by a space in the puzzle grid and the Answer data structure should be updated. If the number of cells to be cleared is greater than the number of entries in the Answer data structure, all digits entered by the user should be cleared. What you need to do: Task 1 Write a new subroutine, ClearEntries, that clears the required number of previously entered digit(s) from the puzzle grid and updates the Answer data structure as described above. Task 2 Amend the subroutine SolvePuzzle to test user input for a negative value. If the user input is a negative integer, the subroutine should call ClearEntries with the necessary parameters and then re-display the puzzle grid. Task 3 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • enter P • load puzzle1 • enter S • enter -x • enter -1 • enter -5 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 14.1 Your PROGRAM SOURCE CODE for the entire subroutine ClearEntries and the entire subroutine SolvePuzzle. [12 marks] 14.2 SCREEN CAPTURE(S) showing the requested test described in Task 3. The SCREEN CAPTURE(S) need(s) to show the puzzle grid before and after the described test. [1 mark]