Question 14

AQA Computer Science June 2024 Paper 1 (7517/1)A level14 marks

On the specification

14.1
4.1 Fundamentals of programming3.1 Fundamentals of programming3.3 Systematic approach to problem solving
14.2
3.3 Systematic approach to problem solving
Question text

14 This question extends the Skeleton Program so that there is a new type of cell – a countdown cell. A countdown cell has a timer associated with it that decreases by one each time the user tries to place a symbol in the puzzle grid. The location of a countdown cell is shown by a numeric digit representing the current value of its timer. When its timer reaches zero, the cell’s symbol changes to an @. A countdown cell should be added to the board each time the user’s score is increased. The location for the countdown cell should be an empty cell on the grid and selected randomly. What you need to do Task 1 Create a new class called CountdownCell that is a subclass of the BlockedCell class. Create a constructor for the CountdownCell class that sets the initial value of the timer and makes sure that the symbol displayed for the cell will be the value of its timer. The first symbol that should be displayed for the timer value of a CountdownCell is 3 Create a method UpdateCell in the CountdownCell class that: • overrides the method from the base class • decreases the value of the timer by one • changes the symbol to @ when the timer has a value of zero. Task 2 Modify the AttemptPuzzle method in the Puzzle class so that, if the amount to add to the score is greater than zero, it selects an empty cell in the grid at random and replaces that cell with a new CountdownCell. Task 3 Modify the AttemptPuzzle method in the Puzzle class so that, immediately before it checks if the number of symbols left is zero, it calls the UpdateCell method for each cell in the grid. Task 4 Test that the changes you have made work: • run the Skeleton Program • load the file puzzle3 • enter 1 • enter 4 • enter X • place a T in an empty cell • place a T in an empty cell • place a T in an empty cell. Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 14.1 Your PROGRAM SOURCE CODE for the new class CountdownCell and the amended AttemptPuzzle method. [13 marks] 14.2 SCREEN CAPTURE(S) showing the requested test. [1 mark]