Question 12
AQA Computer Science June 2022 Paper 1 (7516/1)AS8 marks
On the specification
- 12.1
- 3.1 Fundamentals of programming3.2 Fundamentals of data structures
- 12.2
- 3.3 Systematic approach to problem solving
Question text
12 This question adds further validation to the Skeleton Program. When a puzzle is loaded, some cells already contain numbers. These cells are referred to as protected cells. Figure 5 shows the numbers in the puzzle grid cells when puzzle1 is first loaded. These are the protected cells for this puzzle. Figure 5 12 3 4 5 6 7 8 9 |===.===.===|===.===.===|===.===.===| 1| 8 . . 5 | . . | . . 7 | | | | | 2| 9 . . | 5 . . 4 | . . | | | | | 3| 4 . 1 . | . 6 . | . . | |===.===.===|===.===.===|===.===.===| 4| . . | 7 . . | 1 . 6 . | | | | | 5| 1 . . | 4 . . 6 | . . 3 | | | | | 6| . 5 . 8 | . . 1 | . . | |===.===.===|===.===.===|===.===.===| 7| . . | . 1 . | . 4 . 9 | | | | | 8| . . | 2 . . 7 | . . 1 | | | | | 9| 2 . . | . . | 5 . . 6 | |===.===.===|===.===.===|===.===.===| The Skeleton Program is to be changed so that the user cannot change the contents of any protected cells. The subroutine SolvePuzzle needs to be modified so that the user cannot change a digit in a protected cell but can still enter a digit into an empty cell or change a digit that they have previously entered. What you need to do: Task 1 Amend the subroutine SolvePuzzle so that it checks every cell reference entered by the user against the protected cell references in Puzzle and only allows the contents of the cell to be changed if the cell referenced by CellInfo is not a protected cell. If a protected cell is referenced, an appropriate error message should be displayed. Task 2 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 117 • enter 323 • enter 993 • enter 853 • enter 854 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 12.1 Your PROGRAM SOURCE CODE for the entire subroutine SolvePuzzle. [7 marks] 12.2 SCREEN CAPTURE(S) showing the requested test described in Task 2. The SCREEN CAPTURE(S) need(s) to show the puzzle grid before and after the described test. [1 mark]